0

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 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot for your answer! I'm trying to write a new keyword Click Element On Coordinates to be able to replace my old Click Element statements. The problem is that I don't know how to get the current webdriver instance that may have been created when first importing the Selenium2Library into Robotframework test suite...
If the above solution resolves your problem mean make it as answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.