S
S
Soft_touch_plastic2021-02-24 12:21:47
Python
Soft_touch_plastic, 2021-02-24 12:21:47

Why does selenium Element could not be scrolled into view error occur?

Hello, here is the code that should find the element, when clicked, a modal window appears, and click on it.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("site")
elem = driver.find_element_by_xpath("//img[contains(@src, '/resources/images/personNew.svg')]")
elem.click()
driver.close()

The element is exactly in the top navigation bar, so it must be clickable.
But there is an error:
Traceback (most recent call last):
  File "./user.py", line 8, in <module>
    elem.click()
  File "C:\Users\nevzr\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
  File "C:\Users\nevzr\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "C:\Users\nevzr\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: Element <img class="nav-r-img door" src="/resources/images/personNew.svg"> could not be scrolled into view

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question