java - Action 移动不适用于 : Firefox versions:48 and Selenium: 3. 0.1

标签 java selenium selenium-webdriver webdriver automated-tests

Action Move 适用于: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 did not match a known command Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'

最佳答案

它不起作用,因为 Actions API 尚未在 geckodriver/marionette 中实现。

https://github.com/mozilla/geckodriver/issues/233

您可以使用旧的 firefox 驱动程序并在 FF v47 上降级以使其在 firefox 上运行。

关于java - Action 移动不适用于 : Firefox versions:48 and Selenium: 3. 0.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41765556/

相关文章:

java - 使用 selenium webdriver 运行测试

java - 如何通过 Selenium Webdriver 将文本发送到搜索字段?

Java:ImageIcon - 图像文件更新,但 Java 框架中的图像图标不更新

javascript - 如何查看窗口的 Javascript 窗口 ID?用于 Selenium select_window()

java - 查询延迟客户端和服务器

java - 如何单击位于表格 Selenium 单元格中的元素

java - 我无法使用 driver.findElement(By.xpath()); 找到具有 xpath 的 Web 元素

java - Selenium 启动的 ChromeDriver 一直在后台运行

java - 异常处理的意外输出

java - 如何将用户输入存储到文本文件中并显示所有数据?