SessionNotCreatedError: session not created Error in Protractor automation
SessionNotCreatedError: session not created Error in Protractor automation
我有一个 angular 应用程序,我正在尝试对其进行 运行 Protractor 自动化测试。但是当我尝试 运行 自动化测试时,出现以下错误。
我有 Chrome 浏览器 86 并将 chrome 86 chromedriver.exe 放在 node_moules/protractor/selenium/ 下。但我仍然收到以下错误。
不知道在哪里设置请求量角器拾取的路径chrome86 驱动程序。任何帮助表示赞赏。
Running "shell:protractor_install" (shell) task
selenium standalone is up to date.
Updating chromedriver to version 83.0.4103.61
downloading https://chromedriver.storage.googleapis.com/83.0.4103.61/chromedriver_win32.zip...
Ignoring SSL certificate
>> Error: Got error Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:80 from https://chromedriver.storage.googleapis.com/83.0.4103.61/chromedriver_win32.zip
Running "protractor:test" (protractor) task
[16:20:43] I/direct - Using ChromeDriver directly...
[16:20:43] I/launcher - Running 1 instances of WebDriver
DevTools listening on ws://127.0.0.1:49455/devtools/browser/799cea95-40ad-4ed5-84c0-dfb2aaa13de6
C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\error.js:27
super(opt_error);
^
SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 83
(Driver info: chromedriver=83.0.4103.14 (be04594a2b8411758b860104bc0a1033417178be-refs/branch-heads/4103@{#119}),platform=Windows NT 10.0.17763 x86_64)
at WebDriverError (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\error.js:27:5)
at SessionNotCreatedError (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\error.js:296:5)
at Object.checkLegacyResponse (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\error.js:580:13)
at C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\webdriver.js:64:13
at Promise.invokeCallback_ (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\promise.js:1329:14)
at TaskQueue.execute_ (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\promise.js:2790:14)
at TaskQueue.executeNext_ (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\promise.js:2773:21)
at asyncRun (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\promise.js:2652:27)
at C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
at acquireSession (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\webdriver.js:62:22)
at Function.createSession (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\webdriver.js:295:12)
at Driver (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\chrome.js:778:38)
at Direct.getNewDriver (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\protractor\built\driverProviders\direct.js:65:26)
at Runner.createBrowser (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\protractor\built\runner.js:182:43)
at C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\protractor\built\runner.js:255:30
at _fulfilled (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\q\q.js:796:13)
at C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\q\q.js:556:49
[16:20:52] E/launcher - Process exited with error code 1
>> C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\error.js:27
当我将 protractor/config.json 更改为指向 86
的最新 chromedriver 时,我能够解决问题
{
"webdriverVersions": {
"selenium": "2.52.0",
"chromedriver": "86.0.4240.22",
"iedriver": "2.52.0"
}
}
然后手动下载文件放在protractor/selenium里,把扩展名改成chromedriver_86.0.4240.22.exe
无需下载每个新版本的 chromedriver 即可自动执行此操作是让 webdriver-manager 软件包完成其工作。
node node_modules/protractor/bin/webdriver-manager update
protractor <your_configuration_js>
注意:请参阅上面如何调用 webdriver-manager,它使用项目 npm 模块中的本地版本(而不是全局版本)。它可以很好地同步以下设置。
如果您在 量角器配置 中使用了上述步骤,则必须启用此键。这不需要每次开始测试时 use/execute webdriver-manager start
。
directConnect: true
我有一个 angular 应用程序,我正在尝试对其进行 运行 Protractor 自动化测试。但是当我尝试 运行 自动化测试时,出现以下错误。 我有 Chrome 浏览器 86 并将 chrome 86 chromedriver.exe 放在 node_moules/protractor/selenium/ 下。但我仍然收到以下错误。
不知道在哪里设置请求量角器拾取的路径chrome86 驱动程序。任何帮助表示赞赏。
Running "shell:protractor_install" (shell) task
selenium standalone is up to date.
Updating chromedriver to version 83.0.4103.61
downloading https://chromedriver.storage.googleapis.com/83.0.4103.61/chromedriver_win32.zip...
Ignoring SSL certificate
>> Error: Got error Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:80 from https://chromedriver.storage.googleapis.com/83.0.4103.61/chromedriver_win32.zip
Running "protractor:test" (protractor) task
[16:20:43] I/direct - Using ChromeDriver directly...
[16:20:43] I/launcher - Running 1 instances of WebDriver
DevTools listening on ws://127.0.0.1:49455/devtools/browser/799cea95-40ad-4ed5-84c0-dfb2aaa13de6
C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\error.js:27
super(opt_error);
^
SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 83
(Driver info: chromedriver=83.0.4103.14 (be04594a2b8411758b860104bc0a1033417178be-refs/branch-heads/4103@{#119}),platform=Windows NT 10.0.17763 x86_64)
at WebDriverError (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\error.js:27:5)
at SessionNotCreatedError (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\error.js:296:5)
at Object.checkLegacyResponse (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\error.js:580:13)
at C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\webdriver.js:64:13
at Promise.invokeCallback_ (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\promise.js:1329:14)
at TaskQueue.execute_ (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\promise.js:2790:14)
at TaskQueue.executeNext_ (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\promise.js:2773:21)
at asyncRun (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\promise.js:2652:27)
at C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
at acquireSession (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\webdriver.js:62:22)
at Function.createSession (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\lib\webdriver.js:295:12)
at Driver (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\chrome.js:778:38)
at Direct.getNewDriver (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\protractor\built\driverProviders\direct.js:65:26)
at Runner.createBrowser (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\protractor\built\runner.js:182:43)
at C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\protractor\built\runner.js:255:30
at _fulfilled (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\q\q.js:796:13)
at C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\q\q.js:556:49
[16:20:52] E/launcher - Process exited with error code 1
>> C:\Users2622018\dmro-workspace\Workscope-E2E-Automation\node_modules\selenium-webdriver\error.js:27
当我将 protractor/config.json 更改为指向 86
的最新 chromedriver 时,我能够解决问题{
"webdriverVersions": {
"selenium": "2.52.0",
"chromedriver": "86.0.4240.22",
"iedriver": "2.52.0"
}
}
然后手动下载文件放在protractor/selenium里,把扩展名改成chromedriver_86.0.4240.22.exe
无需下载每个新版本的 chromedriver 即可自动执行此操作是让 webdriver-manager 软件包完成其工作。
node node_modules/protractor/bin/webdriver-manager update
protractor <your_configuration_js>
注意:请参阅上面如何调用 webdriver-manager,它使用项目 npm 模块中的本地版本(而不是全局版本)。它可以很好地同步以下设置。
如果您在 量角器配置 中使用了上述步骤,则必须启用此键。这不需要每次开始测试时 use/execute webdriver-manager start
。
directConnect: true