kidcapital kidcapital - 1 month ago 24
Ruby Question

How to hover over (mouseover) an element in Selenium Ruby?

Anyone know how to hover over an element in Selenium Ruby Webdriver?

My code is like this:

el = driver.find_element(:css => "#foo")
driver.move_to el # How do I trigger a mouseover event on this element?


I'm using selenium-webdriver gem with Firefox in Linux 32-bit.

Answer

Turns out the answer is:

driver.move_to(el).perform

I forgot the .perform.

Comments