1

我在 C# 中编写的测试自动化项目中使用的相同方法在 Internet Explorer 11 中不起作用,即使我使用的移动方法是 chrome、firefox 和 edge。它没有给出任何错误,但下一个动作是失败

log.Debug("fare " + by + " üzeriine dogru haraket ediyor, webelement label ");
IWebElement element = GetElement(by);
Actions Actions = new Actions(Driver);
WaitElementToClickable(Driver, by, 5);
Actions.MoveToElement(element);
Actions.Perform();
WaitElementToClickable(Driver, by, 5);
4

1 回答 1

2

我花了很长时间试图让操作在所有浏览器上都起作用,对于 IE,我发现以下帮助。

Selenium webdriver v2.29.0 ( https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG ) 添加:

IEDriver supports "requireWindowFocus" desired capability. When
using this and native events, the IE driver will demand focus and
user interactions will use SendInput() for simulating user
interactions. Note that this will mean you MUST NOT use the
machine running IE for anything else as the tests are running.

当我设置我使用的 IEDriver 时:

InternetExplorerOptions options = new InternetExplorerOptions();
options.requireWindowFocus();
webDriver = new InternetExplorerDriver(options);

我所有的移动和点击事件都可以正常工作。我正在使用 IE11.125-11.309 和 Selenium (java bindings) 3.7.1。

于 2018-05-11T08:50:14.357 回答