ChromeDriver启动后立即失败,并显示以下错误

问题描述

我正在尝试在天蓝色的devops中在管道中运行量角器e2e测试,但是在加载chrome webdriver之后,它仍然继续失败。我在本地运行相同的脚本,并且运行良好,但是在天蓝色的devop上运行失败。谁能帮助我了解为什么它会失败?

代理规范:ubuntu-18.04 代理程序池:Azure管道 节点版本:10.x 使用Azure Repos

并使用自定义更新根文件夹和./node_modules/protractor中的webdriver-manger

,一旦使用npm运行e2e测试,但直接使用chrome驱动程序后,它就会失败。

2020-09-01T05:29:18.5579903Z [05:29:18] E/launcher - unkNown error: Chrome Failed to start: exited abnormally
2020-09-01T05:29:18.5580800Z   (unkNown error: DevToolsActivePort file doesn't exist)
2020-09-01T05:29:18.5582329Z   (The process started from chrome location /usr/bin/google-chrome is no longer running,so ChromeDriver is assuming that Chrome has crashed.)
2020-09-01T05:29:18.5591888Z   (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 5.3.0-1034-azure x86_64)
2020-09-01T05:29:18.5592529Z [05:29:18] E/launcher - WebDriverError: unkNown error: Chrome Failed to start: exited abnormally
2020-09-01T05:29:18.5593004Z   (unkNown error: DevToolsActivePort file doesn't exist)
2020-09-01T05:29:18.5593565Z   (The process started from chrome location /usr/bin/google-chrome is no longer running,so ChromeDriver is assuming that Chrome has crashed.)
2020-09-01T05:29:18.5594229Z   (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 5.3.0-1034-azure x86_64)
2020-09-01T05:29:18.5594817Z     at Object.checkLegacyResponse (/home/vsts/work/1/s/node_modules/selenium-webdriver/lib/error.js:546:15)
2020-09-01T05:29:18.5595359Z     at parseHttpResponse (/home/vsts/work/1/s/node_modules/selenium-webdriver/lib/http.js:509:13)
2020-09-01T05:29:18.5595916Z     at doSend.then.response (/home/vsts/work/1/s/node_modules/selenium-webdriver/lib/http.js:441:30)
2020-09-01T05:29:18.5596243Z     at process._tickCallback (internal/process/next_tick.js:68:7)
2020-09-01T05:29:18.5596481Z From: Task: WebDriver.createSession()
2020-09-01T05:29:18.5597051Z     at Function.createSession (/home/vsts/work/1/s/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
2020-09-01T05:29:18.5597527Z     at Function.createSession (/home/vsts/work/1/s/node_modules/selenium-webdriver/chrome.js:761:15)
2020-09-01T05:29:18.5597853Z     at Direct.getNewDriver (/home/vsts/work/1/s/node_modules/protractor/built/driverProviders/direct.js:77:33)
2020-09-01T05:29:18.5598181Z     at Runner.createbrowser (/home/vsts/work/1/s/node_modules/protractor/built/runner.js:195:43)
2020-09-01T05:29:18.5598472Z     at q.then.then (/home/vsts/work/1/s/node_modules/protractor/built/runner.js:339:29)
2020-09-01T05:29:18.5598732Z     at _fulfilled (/home/vsts/work/1/s/node_modules/q/q.js:834:54)
2020-09-01T05:29:18.5598967Z     at /home/vsts/work/1/s/node_modules/q/q.js:863:30
2020-09-01T05:29:18.5599328Z     at Promise.promise.promisedispatch (/home/vsts/work/1/s/node_modules/q/q.js:796:13)
2020-09-01T05:29:18.5599570Z     at /home/vsts/work/1/s/node_modules/q/q.js:556:49
2020-09-01T05:29:18.5599801Z     at runSingle (/home/vsts/work/1/s/node_modules/q/q.js:137:13)
2020-09-01T05:29:18.5600161Z [05:29:18] E/launcher - Process exited with error code 199
2020-09-01T05:29:18.6127107Z An unexpected error occurred: undefined
2020-09-01T05:29:18.6680139Z npm ERR! code ELIFECYCLE
2020-09-01T05:29:18.6740337Z npm ERR! errno 1
2020-09-01T05:29:18.6740709Z npm ERR! [email protected] e2e: `ng e2e`
2020-09-01T05:29:18.6740974Z npm ERR! Exit status 1
2020-09-01T05:29:18.6741161Z npm ERR! 
2020-09-01T05:29:18.6741404Z npm ERR! Failed at the [email protected] e2e script.
2020-09-01T05:29:18.6742262Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-09-01T05:29:18.6770493Z 
2020-09-01T05:29:18.6770952Z npm ERR! A complete log of this run can be found in:
2020-09-01T05:29:18.6772054Z npm ERR!     /home/vsts/.npm/_logs/2020-09-01T05_29_18_670Z-debug.log

我知道那里有很多解决方案,但是没有任何解决方案对我有用。到现在为止,我一直尝试过但一直失败的解决方案如下:

  1. 添加“ args”:[“-disable-dev-shm-usage”], 'args':[“-no-sandBox”]。
  2. 使用终端命令尝试并安装Chrome,以确保将其安装在Rakesh在此link中提到的正确路径中。
  3. 尝试将webdriver-manager版本降级到2.38。
  4. 试图在firefox浏览器中运行(该浏览器可以在本地运行,但不能在天蓝色的devops中运行)。
  5. 尝试将directConnect设置为false并给出硒地址
  6. 也以隐身模式运行
  7. 尝试以无头模式运行,该模式在本地和devop上均失败​​
  8. 还尝试运行示例代码,但这也不断引发错误

我还应该怎么做才能解决错误?谁能帮忙

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)