【问题标题】:Selenium 3.14.0+ ClassCast Exception for Actions.movetoElement after upgrading selenium升级 selenium 后 Actions.movetoElement 的 Selenium 3.14.0+ ClassCast 异常
【发布时间】:2018-08-14 19:53:56
【问题描述】:

我已经将selenium升级到最新版本3.14.0,发现下面的方法抛出了类转换异常

new Actions(driver).moveToElement(element).click().build().perform();

java.lang.ClassCastException: com.prahs.utils.logger.EventWebDriver$EventFiringWebElement 无法转换为 org.openqa.selenium.interactions.internal.Locatable

【问题讨论】:

  • 您对此有任何解决方案吗?我刚刚遇到了同样的问题。

标签: java selenium selenium-webdriver


【解决方案1】:

你可以试试这个方法,

Actions action = new Actions(driver);
action.moveToElement("Web Element").click().perform();

构建是为了不同的目的,

参考链接:https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/interactions/Actions.html

【讨论】:

  • 这并没有修复丢失的库。动作仍然无法识别。
【解决方案2】:

您可以使用不同版本的 Selenium for api。

可能与此有关?

Selenium Actions Class cannot be resolved in selenium version greater then 3.1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-27
    • 2020-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-12
    相关资源
    最近更新 更多