Webdriver exception: "chrome not reachable"
Asked Answered
F

4

8

I am running selenium test cases in a ubuntu server which basically runs testcases in both firefox and chrome. Firefox launches and test cases run successfully but chrome throws exception:

*****below is the snippet of the stacktrace:*****

Starting ChromeDriver (v2.8.240825) on port 21549

PAC support disabled because there is no system implementation

Test IntegrationTest.AdminUserelementscheck failed:

org.openqa.selenium.WebDriverException: chrome not reachable (Driver info: chromedriver=2.8.240825,platform=Linux 2.6.32-431.el6.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) [error] Command duration or timeout: 20.83 seconds


Hi Below is the small snippet of my code :

public class IntegrationTest {

private static final String configFile="test.properties";

private final String FIREFOX="firefox";

private final String CHROME="chrome";

private final String PHANTOMJS="phantomjs";

private final String BROWSERNAME="browser";

private static Properties props = new Properties();

public WebDriver webDriver;

private static Configuration additionalConfigurations;


@BeforeClass

public static void setUp() throws IOException, SQLException{

props.load(IntegrationTest.class.getResourceAsStream("/" + configFile));
        }

@test

public void AdminUserelementscheck() throws SQLException, IOException {

String[] browsers = props.getProperty(BROWSERNAME).split(",");

System.out.println("Number of browsers specified in conf:"+props.getProperty(BROWSERNAME));

for(String browser:browsers){

System.out.println("Browser currently processing:"+browser);

if(browser.equalsIgnoreCase(FIREFOX))

webDriver = new FirefoxDriver();

else if(browser.equalsIgnoreCase(CHROME))

webDriver = new ChromeDriver();

else

webDriver = new PhantomJSDriver();

running(testServer(3333,fakeApplication()),webDriver, new Callback<TestBrowser>() {


********* LOGIN AND ASSERTION STATMENTS*******************

browser.quit()

}

});

}
Fidelia answered 6/2, 2015 at 10:47 Comment(1)
It can also be a port forwarding issue between your docker container and a remote device/host.Athalie
L
23

This would be because Chrome is also making use of unix containers in order to run. If you want this to run within docker, pass the docker run command

--privileged

Otherwise you can start Chrome with

--no-sandbox

Lanark answered 9/3, 2015 at 18:27 Comment(5)
@Lanark @ Immanuel Fredrick: Where do I put this command? Please help understand with above as example.Shanna
Okay, I tried passing this to chrome args but it says environment not available in that case.Shanna
--no-sandbox works, but I didn't have to set this in previous versions and it's not so secure tooAguish
Additionally, you'll need to increase dev/shm github.com/elgalu/docker-selenium/issues/…Kelula
is it safe to rely on --no-sandbox for automated tests?Allianora
V
4

I have encoutered similar problem. I am running my Selenium tests locally and "webdriver exception chrome not reachable" error suddenly showed up.

The problem was that I already had too much tabs in my regular chrome browser. After getting frustrated I have closed few tabs and suddenly it worked. I am not sure if there is a certain limit of tabs, but if somebody encounters same problem, give it a try.

Volt answered 12/7, 2016 at 14:11 Comment(1)
I'll try to be more straightforward next time :)Volt
T
1

Your chrome driver seems to be old. Try downloading latest as of date from below and report back if you get any new errors.

http://chromedriver.storage.googleapis.com/index.html?path=2.14/

Telethermometer answered 6/2, 2015 at 16:2 Comment(2)
I tried most of the versions of chromedriver right from 2.7 to 2.14. It throws the same errorFidelia
point to be noted is that the whole setup runs inside a docker containerFidelia
D
0

Also ensure that PATH environment variable has the path to chromedriver.

Diarmuid answered 9/3, 2015 at 18:45 Comment(2)
I have chromedriver executable placed in system environment path. And it is able to pick the chromedriver but not launch it .Fidelia
Did you configure XServer Display parameter such as DISPLAY=:0 before invoking the script?Diarmuid

© 2022 - 2024 — McMap. All rights reserved.