【问题标题】:org.openqa.selenium.InvalidElementStateException:Cannot perform native interaction: Could not load native events componentorg.openqa.selenium.InvalidElementStateException:无法执行本机交互:无法加载本机事件组件
【发布时间】:2012-04-05 10:55:35
【问题描述】:

我在使用 2.15.0 版和 Firefox9 时遇到了这个错误 在将 FF9 更新到 FF10 之后,在 Windows 7 中使用 Java 绑定。我试图禁用 网上建议的本地活动,但没有运气。在网上进一步搜索解决方案后,我将 WebDriver 更新到了 2.17.0 版。问题已解决,我有一段时间没有遇到同样的问题。我再次升级到 WebDriver 的最新版本 2.19.0,问题就解决了。现在我在将 FF10 更新到 11 后面临同样的问题。我升级到 2.20 但问题仍然存在。我如下禁用本机事件,但仍然收到错误消息。

使用 Java:

FirefoxProfile profile = new FirefoxProfile(); 
profile.setPreference("webdriver_enable_native_events", false); 
driver = new FirefoxDriver(profile); 

Stacktrace(当我尝试将鼠标悬停在元素上时):

org.openqa.selenium.InvalidElementStateException: Cannot perform native interaction: Could not load native events component. 
Command duration or timeout: 30.07 seconds
Build info: version: '2.20.0', revision: '16008', time: '2012-02-28 15:00:40'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_31' 
Driver info: driver.version: RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
at java.lang.reflect.Constructor.newInstance(Unknown Source) 
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java: 170) 
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.­java: 123) 
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java: 438) 
at org.openqa.selenium.remote.ExecuteMethod.execute(ExecuteMethod.java: 47) 
at org.openqa.selenium.remote.RemoteMouse.mouseMove(RemoteMouse.java: 89) 
at org.openqa.selenium.interactions.MoveMouseAction.perform(MoveMouseAction.ja­va: 37) 
at org.openqa.selenium.interactions.CompositeAction.perform(CompositeAction.ja­va: 32) 
at org.openqa.selenium.interactions.Actions.perform(Actions.java:349) 
at com.requirementsLive.qa.utility.NavigateHelper.navigate_HoverPageTabs(Navig­ateHelper.java: 49) 

我在 NavigateHelper 中的代码:

WebElement hoverMenu = uiHelper.waitForElementPresent(By.id(tabLocator), 10); 
Actions hoverAction = new Actions(this.getDriver()); 
hoverAction.moveToElement(hoverMenu); 
hoverAction.perform(); ------> line that throws the error 

我错过了什么吗?在 webdriver 中是否有对此的永久修复 或者我们应该升级到最新的网络驱动程序(如果有的话) 每次有FF更新? (这次升级没用)。

谢谢。

【问题讨论】:

    标签: java selenium webdriver selenium-firefoxdriver


    【解决方案1】:

    我建议使用 firefox 9 或 10,因为 WebDriver 2.20.0 或 2.19.0 尚未与最新版本的 firefox 完全兼容。

    【讨论】:

    • 是的,我想知道这一点。谢谢!我刚刚安装了FF10.0.2。我能够成功运行我的测试。问题是我的 FF 设置为自动应用更新。我将其关闭以避免将来出现同样的问题。
    • 嗨,我遇到了上述问题。我降级到 Firefox 10.0.2 并升级到 WebDriver 2.20.0。错误消失了,但悬停仍然不起作用。有什么建议吗?
    • 你能提供更多细节吗?您是否遇到类似 ElementNotVisibleException 的异常?悬停动作对我来说似乎并不一致。之前运行的同一段代码下次可能无法运行。
    【解决方案2】:

    Selenium 2.29.0 发布时支持 FF18(用于原生事件)。这是更新链接:http://selenium.googlecode.com/git/rb/CHANGES.

    可能正在更新到 FF18,selenium-webdriver (2.29.0) 可能会对您有所帮助。

    【讨论】:

    • 是的。只有在最新的 Web 驱动程序支持该 FF 版本之后,我才更新到最新的 FF。谢谢!
    猜你喜欢
    • 2013-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-24
    • 1970-01-01
    • 2014-05-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多