For a while now, I have been having erratic disconnects in the middle of running tests with ChromeDriver.
In general, running a test fails about 4 times out of 5 due to spurious disconnects. I have searched various places, and get the typical "make sure versions are matched" type of remedies, and I've confirmed all those types of things (and it does work sometimes, just not reliably).
I have enabled both logging on ChromeDriver and on Chrome itself.
The ChromeDriver logs show the following:
[1663798219.853][INFO]: Waiting for pending navigations...
[1663798219.853][INFO]: Done waiting for pending navigations. Status: ok
[1663798219.855][INFO]: Waiting for pending navigations...
[1663798219.855][INFO]: Done waiting for pending navigations. Status: disconnected: not connected to DevTools
[1663798219.856][INFO]: [92e53afd3ae86085c877a43ec84f1456] RESPONSE FindElement ERROR disconnected: received Inspector.detached event
(Session info: chrome=105.0.5195.125)
[1663798219.861][INFO]: [92e53afd3ae86085c877a43ec84f1456] COMMAND Screenshot {
}
[1663798219.862][INFO]: resolved localhost to ["::1","127.0.0.1"]
[1663798219.863][INFO]: Waiting for pending navigations...
[1663798219.864][INFO]: Done waiting for pending navigations. Status: ok
[1663798219.864][INFO]: resolved localhost to ["::1","127.0.0.1"]
And there are never any Chrome logs -- in fact the temporary "user dir" is no longer on disk (if it ever was) (e.g.: /var/folders/_0/sjtnzxh11xv6ng8nc1zs9mcc0000gn/T/.com.google.Chrome.hmwNLS ).
ChromeDriver shows Chrome being launched with the logging options:
[1663798210.920][INFO]: Launching chrome: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --allow-pre-commit-input --disable-background-networking --disable-background-timer-throttling --disable-client-side-phishing-detection --disable-default-apps --disable-extensions --disable-gpu --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-automation --enable-blink-features=ShadowDOMV0 --enable-logging --log-level=3 --metrics-recording-only --no-first-run --no-service-autorun --password-store=basic --proxy-bypass-list=* --proxy-server='direct://' --remote-debugging-port=0 --test-type --use-mock-keychain --user-data-dir=/var/folders/_0/sjtnzxh11xv6ng8nc1zs9mcc0000gn/T/.com.google.Chrome.hmwNLS --v=1 --window-size=1920,1080 data:,
[1663798211.779][INFO]: resolved localhost to ["::1","127.0.0.1"]
[1663798211.788][INFO]: [92e53afd3ae86085c877a43ec84f1456] RESPONSE InitSession {
"capabilities": {
"acceptInsecureCerts": false,
"browserName": "chrome",
"browserVersion": "105.0.5195.125",
"chrome": {
"chromedriverVersion": "105.0.5195.52 (412c95e518836d8a7d97250d62b29c2ae6a26a85-refs/branch-heads/5195@{#853})",
"userDataDir": "/var/folders/_0/sjtnzxh11xv6ng8nc1zs9mcc0000gn/T/.com.google.Chrome.hmwNLS"
},
I'm not sure what I'm doing wrong to not get the Chrome logs. I'd prefer not to have to build local copies of ChromeDriver and Chromium to try to diagnose the problem.
Any suggestions on how to go about diagnosis this problem (or even better, how to resolve it)?
Environment:
Platform: MacOS 12.6 (Apple Silicon)
Chrome 105.0.5195.125 (aarm64)
ChromeDriver 105.0.5195.52
I've had this problem ongoing for a long time over many versions of all of the above, and I have never been able to track it down or resolve it.
Thanks for any assistance/suggestions anyone can provide.
Robert