kidcapital kidcapital - 1 year ago 310
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 Source

Turns out the answer is:

driver.move_to(el).perform

I forgot the .perform.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download