对于使用硒服务器-4.0.0-α-2的InternetExplorerOptions类型,未定义attachToEdge



我想用Selenium测试Edge浏览器的IE模式。我在MS网站上找到了解决方案:https://learn.microsoft.com/en-us/microsoft-edge/webdriver-chromium/ie-mode?tabs=java

我正在使用上面链接中给出的以下代码:

import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerOptions;
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.attachToEdgeChrome();
ieOptions.withEdgeExecutablePath("C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe");
WebDriver driver = new InternetExplorerDriver(ieOptions);

我可以得到一个错误,即方法"attachToEdgeChrome()""withEdgeExecutablePath()"没有在InternetExplorerOptions中定义。这里有我遗漏的东西吗?

注意:我的硒罐是硒服务器-4.0.0-α-2.jar

根据ChangeLogs0f硒v4.0.0-alpha-2:

  • 添加基于Chromium的Edge支持。这也包括在树中添加一个新的Chromium驱动程序

因此,理想情况下,文档中的代码块"使用Internet Explorer驱动程序在Microsoft Edge中自动执行IE模式"应该可以无缝工作。

但是,根据最佳实践,您应该始终使用GA版本来执行测试,而不是使用alphabeta发行版,您可以从以下选项中挑选任何人:

  • 硒v4.1.3
  • 硒v4.1.2
  • 硒v4.1.1
  • 硒v4.1.0
  • 硒v4.0.0

最新更新