0

In my application if I move my mouse cursor to a particular place in GUI, the element will get enabled and we can perform an operation on it by clicking on that button element.

But until I move my mouse cursor to that particular place we are not able to see that button.

So while automating if I use Firebug to identify that element, I'm not able to do that, because that element is completely not visible.

How to automate that kind of element using WebDriver (Selenium 2)?

Petr Janeček
  • 37,768
  • 12
  • 121
  • 145
  • Did you look at that: http://stackoverflow.com/questions/6232390/is-there-a-proved-mouseover-workaround-for-firefoxdriver-in-selenium2 – Simiil Sep 25 '13 at 07:38
  • Do you mean you are not able to see the element in the firebug console? Can you give the url? – Vinay Sep 25 '13 at 08:10
  • Without seeing the HTML, it's a bit difficult to come up with a solution. Having said that, if there is a container for the button you can use instead, and use action chains to move the mouse to that container, it should activate the button. – Richard Sep 25 '13 at 15:25

1 Answers1

0

You can move your mouse to the element you're talking about:

WebElement mouseBelongsHere = driver.findElement(By.id("mouseElement"));
new Actions(driver)
    .moveToElement(mouseBelongsHere)
    .perform();

This uses the Advanced Interactions API (JavaDocs).

Petr Janeček
  • 37,768
  • 12
  • 121
  • 145