Webdriverexception:“chrome not reachable”

我在ubuntu服务器上运行seleniumtesting用例,这个服务器基本上在firefox和chrome中运行testing用例。 Firefox启动并且testing用例运行成功,但是chrome抛出exception:

*****下面是stacktrace的片段:*****

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

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

testingIntegrationTest.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 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() } }); } 

这是因为Chrome也在使用unix容器来运行。 如果你想要在docker中运行,可以通过docker run命令

– 特权

否则,您可以启动Chrome

–no沙箱

我曾经遇到类似的问题。 我在本地运行我的Seleniumtesting,突然出现“webdriver exception chrome not reachable”错误。

问题是我的普通Chrome浏览器中已经有了太多的标签。 沮丧后,我已经closures了几个标签,突然它的工作。 我不确定是否有一个标签的一定限制,但如果遇到同样的问题,请试试看。

你的铬驱动程序似乎是旧的。 尝试从下面的date下载最新的,如果你有任何新的错误报告。

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

还要确保PATH环境variables具有通往chromedriver的path。

Interesting Posts