如何配置Protractor(JS)以在Microsoft Edge中运行测试?

Emi*_*ily 3 javascript selenium selenium-webdriver protractor microsoft-edge

我想将我的protractor.conf.js设置为在Edge中而不是在Chrome中运行测试.设置这个

capabilities: {
    'browserName': 'MicrosoftEdge'
}
Run Code Online (Sandbox Code Playgroud)

导致SessionNotCreatedError: Unable to create new service: EdgeDriverService错误代码为199.我从Microsoft的网站下载了MicrosoftWebDriver.exe以获取我的Edge版本,但我无法弄清楚如何告诉Protractor在哪里找到该驱动程序.我试着将它添加到我的用户路径,我的系统路径,在量角器的节点模块文件夹中的硒文件夹,给人一种jvmArgs:或seleniumArgs:的['-Dwebdriver.edge.driver="<path-to-driver"'],但我还是拿到SessionNotCreatedError.

我只编写纯JavaScript,没有Java或C#,我希望所有这些都在protractor.conf.js文件中设置为属性,在实际的测试文件中没有设置.我有最新版本的Node,我确保在运行时关闭Edge ng e2e.我需要更改或添加到配置文件以使其运行?

编辑:从这个github问题,我添加seleniumAddress: http://127.0.01:17556/到我的配置文件,但现在我收到ECONNREFUSED 127.0.0.1:17556错误代码135 的错误.我从github问题的一个评论中得到了该地址,但无论启动我都得到相同的错误边缘驱动程序手动或只是运行ng e2e --config <path-to-config>.


解决方法
添加seleniumAddress: 'http://localhost:4444/wd/hub'到配置文件.手动运行边缘驱动程序webdriver-manager start --edge "<path-to-driver>\MicrosoftWebDriver.exe",然后ng e2e在另一个窗口中运行.非常感谢HaC提供此解决方案!

HaC*_*HaC 7

参考:https://github.com/angular/protractor/issues/2377

  1. 下载并安装Edge驱动程序
  2. 跑webdriver-manager start --edge "C:\path_to_the_driver\MicrosoftWebDriver.exe".默认情况下,这将在端口4444上启动您的selenium服务器,该服务器应该对您开放.
  3. 在您的量角器配置文件中:添加 seleniumAddress: 'http://localhost:4444/wd/hub'