Webdriver异常:“chrome not reachable” [英] Webdriver exception: "chrome not reachable"

查看:3116
本文介绍了Webdriver异常:“chrome not reachable”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在ubuntu服务器上运行硒测试用例,它基本上在Firefox和chrome中都运行测试用例。
Firefox启动和测试用例运行成功但chrome抛出异常:



*****以下是stacktrace的代码段:*****



在端口21549上启动ChromeDriver(v2.8.240825)



PAC支持被禁用,因为没有系统实现



测试IntegrationTest.AdminUserelementscheck失败:



org.openqa.selenium.WebDriverException:chrome not reachable
(驱动程序信息:chromedriver = 2.8.240825,platform = Linux 2.6.32-431.el6.x86_64 x86_64)(警告:服务器没有提供任何堆栈跟踪信息)
[error]命令持续时间或超时:20.83秒






以下是我的代码片段:

  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属性props = new Properties();

public WebDriver webDriver;

private static配置附加配置;


@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(在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>(){


*********登录和评估状态*****************

browser.quit()

}

});

}


解决方案

因为Chrome也正在使用unix容器来运行。如果你想让这个在Docker里运行,通过docker运行命令


- 特权




否则,您可以使用


- no-sandbox



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

}

});

}

解决方案

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

这篇关于Webdriver异常:“chrome not reachable”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆