面对以下错误
config.ts
chrome: {
seleniumAddress: 'http://localhost:4444/wd/hub',
directConnect: true,
browserName: 'chrome',
chromeOptions:{
args: ['--headless','--disable-gpu','--disable-dev-shm-usage','--no-sandbox','window-size=1024,768']
}
10:37:07.923 [10:37:07] I /启动器-运行1个WebDriver实例 10:37:07.923 [10:37:07]我/托管-使用http://localhost:4444/wd/hub上的硒服务器 10:38:09.409 [10:38:09] E /启动器-未知错误:Chrome无法启动:崩溃 10:38:09.409(驱动程序信息:chromedriver = 2.40.565383(76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform = Linux 3.10.0-514.26.2.el7.x86_64 x86_64)(警告:服务器未提供任何堆栈跟踪信息) 10:38:09.409命令持续时间或超时:60.39秒 10:38:09.409构建信息:版本:'3.12.0',版本:'7c6e0b3',时间:'2018-05-08T15:15:08.936Z' 10:38:09.409系统信息:主机:'sigmagoagt-po-a1p.sys.comcast.net',ip:'147.191.72.189',os.name:'Linux',os.arch:'amd64',os。版本:“ 3.10.0-514.26.2.el7.x86_64”,java.version:“ 1.8.0_40” 10:38:09.410驱动程序信息:driver.version:未知 10:38:09.410 [10:38:09] E / launcher-WebDriverError:未知错误:Chrome无法启动:崩溃 10:38:09.410(驱动程序信息:chromedriver = 2.40.565383(76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform = Linux 3.10.0-514.26.2.el7.x86_64 x86_64)(警告:服务器未提供任何堆栈跟踪信息) 10:38:09.410命令持续时间或超时:60.39秒 10:38:09.410构建信息:版本:'3.12.0',版本:'7c6e0b3',时间:'2018-05-08T15:15:08.936Z' 10:38:09.411系统信息:主机:'sigmagoagt-po-a1p.sys.comcast.net',ip:'147.191.72.189',os.name:'Linux',os.arch:'amd64',os。版本:“ 3.10.0-514.26.2.el7.x86_64”,java.version:“ 1.8.0_40” 10:38:09.411驱动程序信息:driver.version:未知 WebDriverError上的10:38:09.411(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/lib/error.js:27:5) 10.38:09.411 at Object.checkLegacyResponse(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/lib/error.js:505:15) 10:38:09.411(位于parseHttpResponse(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/lib/http.js:509:13) doSend.then.response上的10:38:09.412(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/lib/http.js:440:13) 10:38:09.412在process._tickCallback(内部/进程/next_tick.js:109:7) 10:38:09.412来自:任务:WebDriver.createSession() 10:38:09.412 at Function.createSession(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/lib/webdriver.js:777:24) 10:38:09.412 at Function.createSession(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/chrome.js:709:29) 10:38:09.412在createDriver(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/index.js:167:33) 在Builder.build上的10:38:09.412(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/selenium-webdriver/index.js:623:16) 10:38:09.413(Hosted.getNewDriver)(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/lib/driverProviders/driverProvider.ts:60:29) Runner.createBrowser上的10:38:09.413(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/lib/runner.ts:225:39) 10:38:09.413 at q.then.then(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/lib/runner.ts:391:27) 10:38:09.413 at _fulfilled(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:834:54) 10:38:09.413 at self.promiseDispatch.done(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:863:30) 10:38:09.413,位于Promise.promise.promiseDispatch(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:796:13) /app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:556:49上的10:38:09.414 10:38:09.414在runSingle(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:137:13) 刷新时10:38:09.414(/app/go-agent1/pipelines/UI-Automation-Testing/web/client-portal/node_modules/protractor/node_modules/q/q.js:125:13) _combinedTickCallback的10:38:09.414(内部/进程/next_tick.js:73:7) 在process._tickCallback上10:38:09.414(internal / process / next_tick.js:104:9)
答案 0 :(得分:0)
您可以使用Selenium服务器运行测试,也可以直接在浏览器上运行它们。您应删除以下其中一项:
seleniumAddress: 'http://localhost:4444/wd/hub',
或
directConnect: true,
答案 1 :(得分:0)
在centOS计算机上卸载并重新安装Chrome可以解决此问题。遵循“ https://intoli.com/blog/installing-google-chrome-on-centos/”中的安装过程。谢谢。