Saturday, 20 October 2012

How to move cursor in selenium.

In automation testing,you need cursor movement for displaying hidden elements.

Here is a example:

public void mouseOverOnElement(WebElement tagElement)
Actions builder=new Actions(driver);
Point coordinate=tagElement.getLocation();
Robot robot=new Robot();
builder.moveToElement(tagElement, 5,5).build().perform();
builder.moveByOffset(1, 1).build().perform();

catch(Exception e)
{"Error message in mouseOverOnElement method-->"+e);

Using the above code you are able to move mouse cursor.

No comments:

Post a Comment