Action Move dosnt 适用于: Firefox 版本:48 和 Selenium:3.0.1
有什么想法吗? 即使更新浏览器,也会发生相同的问题
public void waitAndClickFirstDrivingExperiencesOption(WebElement element) throws Exception {
WebDriverWait wait2 = new WebDriverWait(driver, 30);
Base_Page basePage = new Base_Page(driver);
try {
Boolean elementPresent = wait2.until(ExpectedConditions.elementToBeClickable(element)).isEnabled();
if (elementPresent == true) {
//Provide a slight timeout before clicking on the element
basePage.scrollToElementByLocator(element);
Thread.sleep(1000);
basePage.actionMoveAndClick(element);
System.out.println("Clicked on the first supercars link, using locator: " + element.toString());
}}catch (StaleElementReferenceException elementUpdated) {
element = this.driver.findElement(By.xpath(".//*[@id='prd_listing']/div/li[1]/a"));
Boolean elementPresent = wait2.until(ExpectedConditions.elementToBeClickable(element)).isEnabled();
if (elementPresent == true) {
basePage.scrollToElementByLocator(element);
Thread.sleep(1000);
basePage.actionMoveAndClick(element);
System.out.println("Clicked on the first supercars link (Stale Exception), using locator: " + element.toString());
}
}catch (Exception e) {
System.out.println("Exception! - could not click on the first supercars link, Exception: " + e.toString());
throw (e);
} finally {
}
}
Exception:org.openqa.selenium.UnsupportedCommandException: POST /session/a9265a9c-f425-4875-82d6-401ff75b1a25/moveto 不匹配 已知命令 内部版本信息: 版本: '3.0.1', 修订版: '1969d75', 时间: '2016-10-18 09:48:19 -0700'
它不起作用,因为 Actions API 尚未在 geckodriver/木偶中实现。
https://github.com/mozilla/geckodriver/issues/233
您可以使用旧的 Firefox 驱动程序并在 FF v47 上降级以使其在 Firefox 上运行。