0
votes

My whole test suite is based on robotframework with the SeleniumLibrary (RC). I'm trying to port it to Selenium2 (webdriver). I'm facing an issue with the Click Element keyword which does not support coordinates argument anymore. I read this post which mentions a MoveToOffsetAction but cannot find it whithin the Selenium2Library seen from robotframework. I also read that the webdriver API has a click_at(locator, coordString)

To sum up the situation, I'm wondering how to convert my selenium RC Click Element Locator Coordinates to a Selenium2 keyword or set of keywords.

Thanks a lot for your help,

Pierre

1

1 Answers

2
votes

In Selenium2 API there is no option to click the element using the co-ordinates.

But you can resolve the issue by using the Action class.

Try this code:

 //Assume driver is instantiated somewhere properly.
 WebElement ele = driver.findElement(By.xpath(Element locator));       
 Actions builder = new Actions(driver);
 builder.moveToElement(ele, 100, 200).click().perform();

By using the above code you can move to the particular element using co-ordinates(here button) and able to click.

For more info http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/interactions/Actions.html