4

Selenium clickAt() function is throwing "Unsupported" exception while using with WebDriver (WebDriverBackedSelenium or just Selenium 2.x using ChromeDriver).

Is there any way to use this Selenium function via WebDriver?

Adding some code for context ...

       ChromeDriver driver = new ChromeDriver();

    driver.findElement(By.id("someID")).clickAt("25, 25");

.clickAt() method isn't even recognized ... however, using the WebDriverBackedSelenium is what provides the Unhandled exception.

Muers
  • 3,190
  • 3
  • 26
  • 32

3 Answers3

3

You have to use Advanced User Interactions API

Click at the specific point inside an element looks like following:

ActionChainsGenerator builder = ((HasInputDevices) driver).actionsBuilder();
Action action = builder
    .moveToElement(elementLocator, xOffset, yOffset)
    .click()
    .build();
action.perform();

At the moment, it is implemented for HtmlUnitDriver and InternetExplorerDriver only, other drivers are work in progress.

2

I have sometimes had similar problem and have fired the two MouseDownAt & MouseUpAt to solve the issue.. Seems as some JavaScript don't fire ok with clickAt always

StefanE
  • 7,578
  • 10
  • 48
  • 75
1

Before you use click command on locator. you should use mouseOver on it.

Normally. this problem happen when link that need to click hidden or invisable.

LinhNhi
  • 11
  • 1