Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium: How can I make WebDriver ignore "Element is not visible" error?

I'm using Selenium WebDriver (v2.5.0). I get this error when I use a driver.click(...)" command

Element is not currently visible and so may not be interacted with Build info: version: '2.5.0', revision: '13516', time: '2011-08-23 18:30:44' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.38-10-generic', java.version: '1.6.0_26' Driver info: driver.version: RemoteWebDriver

In the browser when I mouse hover on an element, the element being clicked becomes visible. Is there any way to check whether something is visible or not?

like image 679
Dave Avatar asked Sep 07 '11 21:09

Dave


1 Answers

You can do it via actions. To achieve what you want, using the Python Webdriver client, but the principle is the same.

ActionChains(driver).move_to_element(driver.find_element(By.ID, 'Foo'))\
  .click(driver.find_element(By.Name, "Bar"))\
  .perform()
like image 142
AutomatedTester Avatar answered Sep 18 '22 12:09

AutomatedTester