Selenium Error: Element Not Visible (different Behaviour On Two Computers)
I am pretty stuck with the following problem. This is a simple script which updates CV on the website. #!/usr/bin/env python3 from selenium import webdriver # Authentication det
Solution 1:
This is probably because of screen resolution is different on your monitor and laptop: target button could be visible on monitor with higher resolution and invisible on laptop with low resolution screen.
To be able to click on target button you might need to scroll page down as below:
refresh_button = browser.find_element_by_css_selector('button.HH-Resume-Touch-Button')
browser.execute_script('arguments[0].scrollIntoView(true);', refresh_button)
refresh_button.click()
UPDATE
I found out that there are 2 buttons with same CSS
selector- the first one is invisible, so you get ElementNotVisibleException
You can use
from selenium.common.exceptions import ElementNotVisibleException
try:
refresh_button = browser.find_elements_by_css_selector('button.HH-Resume-Touch-Button')[0]
except ElementNotVisibleException:
refresh_button = browser.find_elements_by_css_selector('button.HH-Resume-Touch-Button')[1]
Post a Comment for "Selenium Error: Element Not Visible (different Behaviour On Two Computers)"