TestProject Forum
Powered by leading experts in the test automation community

Mouseover elements with selenium in python

I’ve recently started doing automation in python. I am trying to mouseover some elements with selenium webdriver.
In java is seems pretty straightforward with the ‘Actions’ class.

How is it done in python ?

from selenium.webdriver.common.action_chains import ActionChains

def mousehover(self):
    driver = webdriver_connection.connection
    element = driver.find_element_by_link_text(self.locator)
    hover = ActionChains(driver).move_to_element(element)
    hover.perform()