Conner
Conner

Reputation: 413

ChromeDriver hanging sporadically, DevTools request failed. Chrome not reachable error

Tests fail sporadically with the error of "Chrome not reachable".

Throwing a WebDriver exception: chrome not reachable
  (Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.26 seconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z'
System info: host: 'XXXXXXXX', ip: 'XXXXXXXXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: driver.version: Driver
Exception : org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z'
System info: host: 'XXXXXXXX', ip: 'XXXXXXXXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: driver.version: Driver
[ERROR] Driver Initialize - Error initializing driver for browser 'CHROME'.  chrome not reachable
  (Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.26 seconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z'
System info: host: 'XXXXXXXXXX', ip: 'XXXXXXXXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: driver.version: Driver

org.openqa.selenium.WebDriverException: chrome not reachable
  (Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.26 seconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z'
System info: host: 'XXXXXXXX', ip: 'XXXXXXXXX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: driver.version: Driver

When I do some logging I see the error is with the DevTools request failing. This happens sporadically. It looks like chromedriver creates a new port for debugging for each test and sometimes Chromedriver can't connect to the new port. Not sure why and don't know how to fix it. Anyone experience this?

    [1516896066.375][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.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\mna7158\AppData\Local\Temp\scoped_dir6732_10840\internal" --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12923 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\mna7158\AppData\Local\Temp\scoped_dir6732_15347" data:,
[1516896066.431][DEBUG]: DevTools request: http://localhost:12923/json/version
[1516896068.429][DEBUG]: DevTools request failed
[1516896068.480][DEBUG]: DevTools request: http://localhost:12923/json/version
[1516896068.688][DEBUG]: DevTools request failed
[1516896068.739][DEBUG]: DevTools request: http://localhost:12923/json/version
[1516896070.481][DEBUG]: DevTools request failed
[1516896070.532][DEBUG]: DevTools request: http://localhost:12923/json/version
[1516896070.742][DEBUG]: DevTools request failed
[1516896070.793][DEBUG]: DevTools request: http://localhost:12923/json/version
[1516896072.532][DEBUG]: DevTools request failed

Specifications:

Sample code that I get this error with.

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class chromeDriverExample {
public WebDriver driver;
WebDriverWait wait;

@BeforeMethod
public void beforeMethod() {
    System.setProperty("webdriver.chrome.driver", "src//test//resources//drivers//chromedriver.exe");
    System.setProperty("webdriver.chrome.verboseLogging", "true");
    driver = new ChromeDriver();
    wait = new WebDriverWait(driver, 30);
}

@AfterMethod
public void afterMethod() {
    driver.close();
    driver.quit();
}

@Test(invocationCount = 15)
public void chromeTest() {
    driver.get("https://google.com");
    wait.until(ExpectedConditions.presenceOfElementLocated(By.name("q")));
}

}

Upvotes: 1

Views: 1425

Answers (1)

David Mankellow
David Mankellow

Reputation: 41

This may or may not be related but I am seeing something similar. Since my local Chrome auto updated (macOS) to v64 we are seeing quite sporadic Selenium TimeoutExceptions. If I fudge my Chrome version and pin it at version 63, this doesn't happen. Something has been broken or changed in v64, but i'm struggling to pin what. I don't know if a new ChromeDriver is imminent and will fix it though.

Upvotes: 2

Related Questions