divz
divz

Reputation: 7967

Mouse Hover in selenium Ruby using capybara

Searching from many forums i got the code to hover the mouse over an element .I want to hover the mouse over a thumbnail image. i put html element ".thumbnail" as class inside find_element method .I dont know which parameter should i place inside find_element method?

My html element is given below.

<a class="thumbnail">
<span class="badgeFeatured">featured</span>
<img alt="" src="https://do3dm75n3e02m.cloudfront.net/arts/preview_3ds/14/original/open-uri20121128-5897-wh90rf_1354148717.png20121128-5897-194vld7-0?1354148717">
<p>Flourish Happy Birthday</p>
</a>


 el = driver.find_element(:class => "thumbnail")
driver.move_to.(el).perform

Due to this problem it does not move mouse over the thumbnail image.

Upvotes: 1

Views: 1680

Answers (1)

Minal K Sinha
Minal K Sinha

Reputation: 424

In Webdriver(java), we can perform mouse over action like this:

Actions actions = new Actions(driver);
WebElement imageSpan = driver.findElement(By.className("badgeFeatured"));
actions.moveToElement(imageSpan);

Upvotes: 1

Related Questions