I'm running Codeception tests in our Pipeline using Google Chrome and ChromeDriver on Linux.
When I was using for this Chrome version installed from the downloaded .deb package, it was working fine, but had to switch to Chrome for Testing due to Chrome and ChromeDriver versions mismatch and I can't no longer initiate the tests.
I'm using Chrome for Testing from here (from here https://googlechromelabs.github.io/chrome-for-testing/) and I extracted the files to the /tmp/chrome/chrome-linux64/ path, then moved them to /opt/google/chrome/ and made a link to the path /usr/bin/google-chrome (probably worth noting I'm using our custom Docker image for this):
ln -s /opt/google/chrome/chrome /usr/bin/google-chrome
After trying many solutions I'm still stuck with this error for every Codeception test:
[Facebook\WebDriver\Exception\SessionNotCreatedException] session not created: Chrome failed to start: exited normally.
(session not created: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
I tried changing Chrome options, I've fixed all dbus errors I was getting earlier and I ran Chrome outside of the Codeception instance and it worked fine. Right now my testing suite code looks like this:
[...]
modules:
enabled:
- WebDriver:
url: http://127.0.0.1/index.php
port: 9515
os: linux
browser: chrome
capabilities:
acceptInsecureCerts: true
platformName: "linux"
chromeOptions:
args: ["--no-sandbox",
"--headless=new",
"--disable-gpu",
"--window-size=1920,1080",
"--start-maximized",
"--disable-extensions",
"--proxy-server='direct://'",
"--proxy-bypass-list=*",
"--disable-dev-shm-usage",
"--ignore-certificate-errors",
"--remote-allow-origins=*"]
binary: "/usr/bin/google-chrome"
[...]
I run the ChromeDriver in the background using this command (it never actually changed and still works fine):
nohup /usr/bin/chromedriver --url-base=wd/hub &
I also checked the ps aux command after unsuccessful tests and noticed that Chrome left many CrashPad processes:
root 1167 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>
root 1173 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>
root 1175 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>
root 1181 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>
root 1183 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>
root 1189 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>
root 1191 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>
root 1197 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>
root 1199 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>
root 1205 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>
root 1207 0.0 0.0 0 0 ? Z 13:17 0:00 [chrome_crashpad] <defunct>