Recently started getting an issue with Selenium Chrome Driver. This started happening around the 29th of June. At first it was giving a timeout error and with some changes, began receiving "Chrome not reachable" errors.
I've read a lot of the questions previously posted and tried a bunch of different solutions given. None of those seemed to fix the issue unfortunately.
Normally the "--headless" option is used, but for testing I removed that to watch it go through. The chrome window does appear but it won't navigate to the URL.
The version I'm using is 103.0.5060.5300 on Chrome and the Chrome Driver. Here's the code that's being initiated when it gets called (Note: all the commented out lines have been different solutions I've tried, but this was the original code that has been working until recently).
public ChromeHeadless()
{
//var service = ChromeDriverService.CreateDefaultService();
//service.LogPath = "D:\\chromedriver.log";
//service.EnableVerboseLogging = true;
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.PageLoadStrategy = PageLoadStrategy.Normal;
//chromeOptions.SetLoggingPreference(LogType.Browser, LogLevel.All);
chromeOptions.AddArgument("--headless");
//chromeOptions.AddArgument("--no-sandbox");
//chromeOptions.SetLoggingPreference(LogType.Browser, LogLevel.All);
driver = new ChromeDriver(chromeOptions);
//driver = new ChromeDriver(service, chromeOptions, TimeSpan.FromMinutes(3));
//driver = new ChromeDriver(service, chromeOptions);
}
The "no-sandbox" or "--no-sandbox" seemed to be a common solutions that didn't have any effect on this issue.
Here is the code that is called when it tries to navigate to the url with the timeouts currently set to 120 but usually 60:
private void NavigateToURL(string url)
{
if (driver == null) throw new Exception("Please create a new instance, the resources have been disposed.");
driver.Manage().Timeouts().PageLoad = new TimeSpan(0, 0, 0, Core.Properties.Settings.Default.SeleniumPageLoadTimeout, 0);
driver.Manage().Timeouts().AsynchronousJavaScript = new TimeSpan(0, 0, 0, Core.Properties.Settings.Default.SeleniumAsyncJSTimeout, 0);
driver.Navigate().GoToUrl(url);
}
Any help is appreciated.
Thank You!
EDIT: Error Log Trace:
[INFO]: Starting ChromeDriver 103.0.5060.53 (a1711811edd74ff1cf2150f36ffa3b0dae40b17f-refs/branch-heads/5060@{#853}) on port 56389
[INFO]: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[INFO]: [9643e0a93623ae715a18e39a50665f01] COMMAND InitSession {
"capabilities": {
"firstMatch": [ {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [ "--headless", "no-sandbox" ]
},
"goog:loggingPrefs": {
"browser": "ALL"
},
"pageLoadStrategy": "normal"
} ]
}
}
[INFO]: Populating Preferences file: {
"alternate_error_pages": {
"enabled": false
},
"autofill": {
"enabled": false
},
"browser": {
"check_default_browser": false
},
"distribution": {
"import_bookmarks": false,
"import_history": false,
"import_search_engine": false,
"make_chrome_default_for_user": false,
"skip_first_run_ui": true
},
"dns_prefetching": {
"enabled": false
},
"profile": {
"content_settings": {
"pattern_pairs": {
"https://*,*": {
"media-stream": {
"audio": "Default",
"video": "Default"
}
}
}
},
"default_content_setting_values": {
"geolocation": 1
},
"default_content_settings": {
"geolocation": 1,
"mouselock": 1,
"notifications": 1,
"popups": 1,
"ppapi-broker": 1
},
"password_manager_enabled": false
},
"safebrowsing": {
"enabled": false
},
"search": {
"suggest_enabled": false
},
"translate": {
"enabled": false
}
}
[INFO]: Populating Local State file: {
"background_mode": {
"enabled": false
},
"ssl": {
"rev_checking": {
"enabled": false
}
}
}
[INFO]: Cannot switch to US keyboard layout - some keys may be interpreted incorrectly
[INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-pre-commit-input --disable-background-networking --disable-backgrounding-occluded-windows --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-automation --enable-blink-features=ShadowDOMV0 --enable-logging --headless --log-level=0 --no-first-run --no-sandbox --no-service-autorun --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Windows\TEMP\scoped_dir6296_1256668697" data:,
[DEBUG]: DevTools HTTP Request: http://localhost:56392/json/version
[DEBUG]: DevTools HTTP Request failed
[DEBUG]: DevTools HTTP Request: http://localhost:56392/json/version
[DEBUG]: DevTools HTTP Request failed
[DEBUG]: DevTools HTTP Request: http://localhost:56392/json/version
[DEBUG]: DevTools HTTP Request failed
[DEBUG]: DevTools HTTP Request: http://localhost:56392/json/version
[DEBUG]: DevTools HTTP Request failed
[DEBUG]: DevTools HTTP Request: http://localhost:56392/json/version
[DEBUG]: DevTools HTTP Request failed
[DEBUG]: DevTools HTTP Request: http://localhost:56392/json/version
[DEBUG]: DevTools HTTP Request failed
[INFO]: Failed to connect to Chrome. Attempting to kill it.
[INFO]: [9643e0a93623ae715a18e39a50665f01] RESPONSE InitSession ERROR chrome not reachable
[DEBUG]: Log type 'driver' lost 0 entries on destruction
[DEBUG]: Log type 'browser' lost 0 entries on destruction