了解“无法执行本地交互:无法使用Firefox和Selenium Webdriver加载本地事件组件” [英] Understanding of 'Cannot perform native interaction: Could not load native events component` with Firefox and Selenium Webdriver

查看:143
本文介绍了了解“无法执行本地交互:无法使用Firefox和Selenium Webdriver加载本地事件组件”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很多时候,在Firefox上运行自动Selenium测试时,人们会遇到以下错误:

  Selenium :: WebDriver :: Error :: InvalidElementStateError:Can not perform native interaction:Could not loaded native events component.` 

有人可以帮忙我懂技术:


  1. 什么原因导致这个错误发生?


  2. 为什么只在Firefox上显示,而不在Chrome浏览器中显示?


解决方案

默认情况下,Windows驱动程序使用所谓的本地事件与元素进行交互。也就是说,鼠标和键盘的交互是使用操作系统级别的机制来模拟的,而不是使用JavaScript来模拟交互的更常见但可能有限且不太精确的用法。对于Firefox,这需要从C ++源代码编译加载特定于操作系统的二进制库(Linux上的.so,Windows上的.dll)。这些二进制库必须链接到特定版本的Gecko SDK,这意味着它们只能被特定版本的Firefox加载和使用。



由于支持每个版本的Firefox会使驱动程序显着膨胀,WebDriver团队限制了任何Selenium版本将支持的版本数量。目前的Firefox支持政策是支持当前的Firefox版本,即刻之前的Firefox版本,当前的Firefox扩展支持版本(ESR)以及之前的ESR版本。请注意,所有版本都是在Selenium项目发布日期计算的。



由于新的Firefox版本涉及新的SDK,因此Selenium项目必须编译新的本地事件组件来支持它,并使用这些组件发布一个新的Selenium版本。该项目试图尽可能推出一个新的版本,以释放一个新的Firefox版本,但由于这是一个全志愿者项目,由于Mozilla可以(而且确实)将Gecko SDK从版本更改为版本而没有任何警告, Selenium更新有时会延迟。

还有两点:首先,Firefox驱动程序体系结构在这方面是独一无二的,所以在其他浏览器中不会看到这种行为。需要注意的是,其他浏览器确实需要更新的驱动程序来处理更新的浏览器版本(请参阅chromedriver.exe)。其次,当Mozilla的FirefoxDriver2(也称为Marionette)完成并发布时,这种架构完全改变。发布木偶的时间表取决于Mozilla,所以你必须联系他们以获得有关这方面的任何信息。

Many times, while running automated Selenium tests on Firefox, people come across following error:

Selenium::WebDriver::Error::InvalidElementStateError: Cannot perform native interaction: Could not load native events component.`

Could someone help me to understand technically:

  1. What causes this error to occur?
  2. How is it solved with releasing new Selenium Webdriver version?
  3. Why it manifests only on Firefox, not with Chrome, IE?

解决方案

By default on Windows, the Firefox driver uses so-called "native events" for interacting with elements. That is to say, mouse and keyboard interactions are simulated using OS-level mechanisms, rather than the more common, but potentially limited and less accurate use of JavaScript to simulate the interaction. In the case of Firefox, this requires loading an OS-specific binary library (.so on Linux, .dll on Windows) compiled from C++ sources. These binary libraries must be linked to a specific version of the Gecko SDK, which means that they can only be loaded and used by specific versions of Firefox.

Since supporting every version of Firefox would bloat the driver significantly, the WebDriver team limits the number of versions any Selenium release will support. The current support policy for Firefox is to support the current Firefox release, the immediately prior Firefox release, the current Firefox Extended Support Release (ESR), and the immediately prior ESR release. Note that all versions are calculated at the date of release of the Selenium project.

Since a new Firefox release involves a new SDK, the Selenium project has to compile new native event components to support it, and release a new Selenium version with those components. The project tries to push a new release as closely as possible to the release of a new Firefox version, but since it's an all-volunteer project, and since Mozilla can (and does!) change the Gecko SDK from version to version without warning, the Selenium update is sometimes delayed.

Two further points: First, the Firefox driver architecture is unique in this respect, so you won't see this behavior in other browsers. It is important to note though that other browsers do require updated drivers to handle updated browser versions (cf. chromedriver.exe). Second, this architecture changes entirely when FirefoxDriver2, also called Marionette, is completed and released by Mozilla. The timetable for the release of Marionette is up to Mozilla, so one would have to contact them for any information about that.

这篇关于了解“无法执行本地交互:无法使用Firefox和Selenium Webdriver加载本地事件组件”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆