I want to click a button which is visible after hovering. Its html is:
I used this code:
import selenium.webdriver as webdriver from selenium.webdriver.common.action_chains import ActionChains url = "http://example.com" driver = webdriver.Firefox() driver.get(url) element = driver.find_element_by_class_name("info") hov = ActionChains(driver).move_to_element(element) hov.perform() element.click()
It's not working though. I got a an error connected with the last line of code
selenium.common.exceptions.ElementNotVisibleException: Message: \ u'Element is not currently visible and so may not be interacted with'
Any suggestions please?
I bet you should wait for the element until it becomes visible.
I'd go with the second option.
On this particular site hovering via selenium didn't work at all, so the only option was to click on the button using js via
Hope that helps.