问题描述
我想将我的protractor.conf.js设置为在Edge中而不是在Chrome中运行测试。设置此
I want to set my protractor.conf.js to run tests in Edge instead of in Chrome. Setting this
capabilities: {
'browserName': 'MicrosoftEdge'
}
导致 SessionNotCreatedError:无法创建新服务:EdgeDriverService
with a错误代码199.我从,但我无法弄清楚如何告诉量角器在哪里找到该驱动程序。我已经尝试将它添加到我的用户路径,我的系统路径,量角器的节点模块文件夹中的selenium文件夹,并提供 jvmArgs:
或 seleniumArgs :
of [' - Dwebdriver.edge.driver =< path-to-driver']
,但我仍然得到了SessionNotCreatedError。
results in SessionNotCreatedError: Unable to create new service: EdgeDriverService
with an error code of 199. I downloaded the MicrosoftWebDriver.exe for the version of Edge that I have from Microsoft's website, but I can't figure out how to tell Protractor where to find that driver. I've tried adding it to my user path, my system path, the selenium folder in protractor's node modules folder, and giving a jvmArgs:
or seleniumArgs:
of ['-Dwebdriver.edge.driver="<path-to-driver"']
, but I still get that SessionNotCreatedError.
我只编写纯JavaScript,没有Java或C#,我希望所有这些都在protractor.conf.js文件中设置为属性,没有设置在实际的测试文件中。我有最新版本的Node,我确保在运行 ng e2e
时关闭Edge。我需要更改或添加到配置文件以使其运行?
I'm only writing pure JavaScript, no Java or C#, and I want all of this to be set as attributes in the protractor.conf.js file, nothing set in the actual file of tests. I have the most recent version of Node, and I'm making sure to have Edge closed when running ng e2e
. What do I need to change or add to my config file to get this to run?
编辑:来自,我添加了 seleniumAddress:http://127.0.01:17556 /
to我的配置文件,但现在我得到一个 ECONNREFUSED 127.0.0.1:17556
错误,错误代码为135.我从该github问题的一条评论中得到了该地址,但无论手动启动Edge驱动程序还是只运行 ng e2e --config< path-to-config>
,我都会收到同样的错误。
From this github issue, I added seleniumAddress: http://127.0.01:17556/
to my config file, but now I'm getting an ECONNREFUSED 127.0.0.1:17556
error with error code 135. I got that address from one of the comments on that github issue, but I get the same error regardless of starting the Edge driver manually or just running ng e2e --config <path-to-config>
.
解决方案
添加 seleniumAddress:'http:// localhost: 4444 / wd / hub'
到配置文件。使用 webdriver-manager start --edge< path-to-driver> \ MicrosoftWebDriver.exe
手动运行边缘驱动程序,然后运行 ng e2e
在另一个窗口中。非常感谢HaC提供此解决方案!
SOLUTION
Add seleniumAddress: 'http://localhost:4444/wd/hub'
to the config file. Run the edge driver manually with webdriver-manager start --edge "<path-to-driver>\MicrosoftWebDriver.exe"
, and then run ng e2e
in another window. Thank you so much to HaC for this solution!
推荐答案
参考:
- 下载并安装Edge驱动程序
- 运行
webdriver-manager start --edgeC:\ path_to_the_driver\MicrosoftWebDriver.exe
。默认情况下,这将在端口4444上启动您的selenium服务器,该服务器应该对您开放。 - 在您的量角器配置文件中:add
seleniumAddress:'http:// localhost :4444 / wd / hub'
- Download and install Edge driver
- Run
webdriver-manager start --edge "C:\path_to_the_driver\MicrosoftWebDriver.exe"
. By default this will start your selenium server on port 4444 which should be open to you. - In your protractor config file: add
seleniumAddress: 'http://localhost:4444/wd/hub'
这篇关于如何配置Protractor(JS)以在Microsoft Edge中运行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!