gpt4 book ai didi

java - 在运行时切换 WebDriver 的 native 事件功能

转载 作者:行者123 更新时间:2023-11-30 07:17:05 25 4
gpt4 key购买 nike

当启用“ native 事件”时,在 Internet Explorer 上运行时,使用“Action Builder”将鼠标悬停在元素上等鼠标操作似乎并不可靠。 (Chrome 和 Firefox 完美运行)

在使用以下代码禁用“ native 事件”时,鼠标操作(如悬停在元素上)也开始按预期在 Internet Explorer 中工作。但是当“本地事件”被禁用时,很多其他事情都会停止工作(比如点击按钮)。

Capabilities.setCapability("nativeEvents", false);
driver = new RemoteWebDriver(new URL("http://localhost:5556/wd/hub"), Capabilities);

因此,是否可以在运行时切换 WebDriver 的“ native 事件”设置,如下所示?

driver = new RemoteWebDriver(new URL("http://localhost:5556/wd/hub"), Capabilities);
.
.
driver.setCapability("nativeEvents", false);
Perform Hover-over operations
driver.setCapability("nativeEvents", true);
Perform other operations
.
.
.

最佳答案

不,您为 WebDriver 提供的功能是为该实例的生命周期设置的。

因此,您不能随心所欲地更改它们。

关于java - 在运行时切换 WebDriver 的 native 事件功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16433604/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com