Selenium 2.0 / WebDriver clickAt()方法不受支持

时间:2010-11-29 16:08:55

标签: selenium webdriver selenium-webdriver

Selenium clickAt()函数在使用WebDriver(WebDriverBackedSelenium或使用ChromeDriver的Selenium 2.x)时抛出“Unsupported”异常。

有没有办法通过WebDriver使用这个Selenium功能?

为上下文添加一些代码......

       ChromeDriver driver = new ChromeDriver();

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

.clickAt()方法甚至无法识别...但是,使用WebDriverBackedSelenium提供了未处理的异常。

3 个答案:

答案 0 :(得分:3)

您必须使用Advanced User Interactions API

单击元素内的特定点,如下所示:

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

目前,它仅针对HtmlUnitDriver和InternetExplorerDriver实施,其他驱动程序正在进行中。

答案 1 :(得分:2)

我有时遇到过类似的问题并且已经解雇了两个MouseDownAt& MouseUpAt解决问题..似乎有些JavaScript无法点击clickAt总是

答案 2 :(得分:1)

在定位器上使用click命令之前。你应该在它上面使用mouseOver。

常。当需要单击隐藏或隐藏的链接时会发生此问题。

相关问题