Webdriver exception: “chrome not reachable”

2019-01-18 14:11发布

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()

}

});

}

4条回答
ゆ 、 Hurt°
2楼-- · 2019-01-18 14:33

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

查看更多
萌系小妹纸
3楼-- · 2019-01-18 14:43

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

查看更多
孤傲高冷的网名
4楼-- · 2019-01-18 14:54

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/

查看更多
狗以群分
5楼-- · 2019-01-18 14:55

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.

查看更多
登录 后发表回答