問題描述
我想將我的 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: Unable to create new service: EdgeDriverService
錯誤代碼為 199.我從 Microsoft 的網站,但我不知道如何告訴 Protractor 在哪里可以找到該驅動程序.我嘗試將它添加到我的用戶路徑、系統路徑、量角器節(jié)點模塊文件夾中的 selenium 文件夾,并給出 jvmArgs:
或 seleniumArgs:
的 ['-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?
從 這個 github 問題,我添加了 seleniumAddress: http://127.0.01:17556/
到我的配置文件,但現在我收到 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 "
手動運行邊緣驅動程序,然后在另一個窗口中運行 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!
推薦答案
參考:https://github.com/angular/protractor/issues/2377
- 下載并安裝 Edge 驅動
- 運行
webdriver-manager start --edge "C:path_to_the_driverMicrosoftWebDriver.exe"
.默認情況下,這將在端口 4444 上啟動您的 selenium 服務器,該端口應該對您開放. - 在量角器配置文件中:添加
seleniumAddress: 'http://localhost:4444/wd/hub'
- Download and install Edge driver
- Run
webdriver-manager start --edge "C:path_to_the_driverMicrosoftWebDriver.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'
這篇關于如何配置量角器 (JS) 以在 Microsoft Edge 中運行測試?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!