我正在在 Electron 中运行的应用程序中进行 E2E 测试,为了使其能够在 Jenkins 的管道中运行,我将它放在运行 Windows 服务(构建版本 1903)映像的 docker 容器中。问题是 chrome 驱动程序在容器内崩溃。
我正在使用这些依赖项(Spectron 和电子):
"electron": "^6.0.12",
"spectron": "^8.0.0"
我收到了这个错误:
{ Error: unknown error: Chrome failed to start: exited normally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location C:\Users\rvlima\node_modules\spectron\lib\launcher.bat is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=78.0.3904.11 (eaaae9de6b8999773fa33f92ce1e1bbe294437cf-refs/branch-heads/3904@{#86}),pla
tform=Windows NT 10.0.18362 x86_64)
at new RuntimeError (C:\Users\rvlima\node_modules\webdriverio\build\lib\utils\ErrorHandler.js:143:12)
at Request._callback (C:\Users\rvlima\node_modules\webdriverio\build\lib\utils\RequestHandler.js:318:39)
at Request.self.callback (C:\Users\rvlima\node_modules\request\request.js:185:22)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at Request.<anonymous> (C:\Users\rvlima\node_modules\request\request.js:1161:10)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at IncomingMessage.<anonymous> (C:\Users\rvlima\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:286:20)
at IncomingMessage.emit (events.js:203:15)
at IncomingMessage.EventEmitter.emit (domain.js:448:20)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
details: undefined,
message:
'Client initialization failed after 10 attempts: RuntimeError Client initialization failed after 10 attempts: ',
type: 'RuntimeError',
seleniumStack:
{ type: 'UnknownError',
message:
'An unknown server-side error occurred while processing the command.',
orgStatusMessage:
'unknown error: Chrome failed to start: exited normally\n (unknown error: DevToolsActivePort file doesn\'t exi
st)\n (The process started from chrome location C:\\Users\\rvlima\\node_modules\\spectron\\lib\\launcher.bat is no l
onger running, so ChromeDriver is assuming that Chrome has crashed.)\n (Driver info: chromedriver=78.0.3904.11 (eaaa
e9de6b8999773fa33f92ce1e1bbe294437cf-refs/branch-heads/3904@{#86}),platform=Windows NT 10.0.18362 x86_64)' } }
另一点是,这可以在版本 1803 的 Windows 容器中工作,但不幸的是,我无法使用该版本,因为 Jenkins 机器使用的是 Windows 的最新版本(1903)。