I have some automated tests that run with Selenium and chromedriver in Windows on an Electron app. I have a check in my testscript to extract the Electron version from the app and immediately fail if it doesn't match whatever version of chromedriver I last installed (hard-coded as I can't find the Electron version anywhere in the binary) as I know mismatched chromedrivers cause headaches.
All was working fine with with Electron 3.0.10 and the version of chromedriver it needed. The app then got upgraded to Electron version 4.2.4 and my check failed the tests.
So I go to https://github.com/electron/electron/releases/tag/v4.2.4 and download the x64 Windows chromedriver, drop it in place of my original 3.0.10 chromedriver, bump the version in my check code and now I get this error:
unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.627115 (620b64671c6c18b7e1bb55c49ad4d073f458aa9b),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.21 seconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '<HOSTNAME>', ip: '<IP>', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131'
Driver info: driver.version: unknown
Stacktrace:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (None:-2)
...
I shortened the Stacktrace:
to make it more readable.
I have seen this previously, but that was when I was just using the latest chromedriver version before I realised they had to be matched, and at the time installing the correct version just fixed the issue.
I've even rebooted the Windows machine and it made no difference.
In Selenium, when I start chromedriver, I tell it to log out to a file and here is an excerpt of it:
[1562084989.049][INFO]: Cannot switch to US keyboard layout - some keys may be interpreted incorrectly
[1562084989.049][INFO]: Launching chrome: "C:\path\to\electron-app.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --load-extension="C:\Users\admin\AppData\Local\Temp\scoped_dir4456_4825\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir="c:\users\admin\appdata\local\temp\tgdfgx"
[1562085049.089][INFO]: Failed to connect to Chrome. Attempting to kill it.
[1562085049.158][INFO]: RESPONSE InitSession unknown error: DevToolsActivePort file doesn't exist
[1562085049.158][DEBUG]: Log type 'driver' lost 0 entries on destruction
[1562085049.158][DEBUG]: Log type 'browser' lost 0 entries on destruction
Edit: Also I know there's loads of StackOverflow posts for this error, but in all of those that I've looked through, and believe me I've been through a lot, people are using mismatched versions. But I've been very careful to not do that and to use the right version.
I've tried adding --no-sandbox
without any luck.
Equally, some answers mention adding --headless
or --disable-dev-shm-usage
but I don't want Chrome to run headless, I want to run a full browser which I can see. Second this runs on Windows, which doesn't have a /dev/shm
!