Selenium服务器错误:java.net.SocketTimeoutException:

时间:2018-03-01 14:42:24

标签: selenium ubuntu selenium-webdriver selenium-chromedriver

当我运行PHP时,selenium测试从服务器获得错误:

  

java.net.SocketTimeoutException:timeout

从测试:

  

PHPUnit_Extensions_Selenium2TestCase_WebDriverException:无法从org.openqa.selenium.remote.NewSessionPayload@6161d7ca创建会话   构建信息:版本:' 3.9.0',修订版:' 698b3178f0',时间:' 2018-02-05T14:56:13.134Z'   系统信息:主机:' lamp-s-1vcpu-1gb-fra1-01',ip:' 127.0.1.1',os.name:' Linux' ,os.arch:' amd64',os.version:' 4.4.0-109-generic',java.version:' 1.8.0_151'   驱动程序信息:driver.version:未知

系统信息:

  

Ubuntu 16.04

     

Google Chrome 64.0.3282.186

     

Chrome驱动程序2.35

     

Selenium server standalone 3.9.0

<?php
require_once __DIR__ . '/vendor/autoload.php';

class WebTest extends PHPUnit_Extensions_Selenium2TestCase
{
    public function setUp()
    {
        $this->setHost('localhost');
        $this->setPort(4444);
        $this->setBrowserUrl('https://www.google.com/');
        $this->setBrowser('chrome');
    }

    public function testTable()
    {
        $this->url('/info.php');

        $this->assertEquals('test', $this->byTag('body')->text());
    }
}

运行服务器:

  

xvfb-run java -Dwebdriver.chrome.driver = / usr / local / bin / chromedriver235 -jar /usr/local/bin/selenium-server-standalone390.jar

有什么不对?

我认为问题在于:&#34;驱动程序信息:driver.version:unknown&#34;。

但为什么司机未知?

服务器启动信息:

> 10:13:24.496 INFO - Selenium build info: version: '3.9.0', revision: '698b3178f0' 10:13:24.502 INFO - Launching a standalone
> Selenium Server on port 4444 2018-03-04 10:13:24.947:INFO::main:
> Logging initialized @1774ms to
> org.seleniumhq.jetty9.util.log.StdErrLog 2018-03-04
> 10:13:25.455:INFO:osjs.Server:main: jetty-9.4.7.v20170914, build
> timestamp: 2017-11-21T21:27:37Z, git hash:
> 82b8fb23f757335bb3329d540ce37a2a2615f0a8 2018-03-04
> 10:13:25.553:WARN:osjs.SecurityHandler:main:
> ServletContext@o.s.j.s.ServletContextHandler@7791a895{/,null,STARTING}
> has uncovered http methods for path: / 2018-03-04
> 10:13:25.567:INFO:osjsh.ContextHandler:main: Started
> o.s.j.s.ServletContextHandler@7791a895{/,null,AVAILABLE} 2018-03-04
> 10:13:25.672:INFO:osjs.AbstractConnector:main: Started
> ServerConnector@7152251d{HTTP/1.1,[http/1.1]}{0.0.0.0:4444} 2018-03-04
> 10:13:25.679:INFO:osjs.Server:main: Started @2506ms 10:13:25.679 INFO
>     - Selenium Server is up and running on port 4444

当我运行测试时:

> 2018-03-04 10:16:23.711:INFO:osjshC.ROOT:qtp472654579-9:
> org.openqa.selenium.remote.server.WebDriverServlet-26653222:
> Initialising WebDriverServlet 10:16:23.986 INFO - Found handler:
> org.openqa.selenium.remote.server.commandhandler.BeginSession@13cc69b6
> 10:16:24.003 INFO - /session: Executing POST on /session (handler:
> BeginSession) 10:16:24.323 INFO - Capabilities are: Capabilities
> {browserName: chrome} 10:16:24.334 INFO - Capabilities {browserName:
> chrome} matched class
> org.openqa.selenium.remote.server.ServicedSession$Factory (provider:
> org.openqa.selenium.chrome.ChromeDriverService) Starting ChromeDriver
> 2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881) on port 8879 Remote connections are allowed by a whitelist
> (localhost,127.0.0.1,100.100.100.100). 10:16:35.607 WARN - Read timed
> out java.net.SocketTimeoutException: Read timed out
>         at java.net.SocketInputStream.socketRead0(Native Method)
>         at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
>         at java.net.SocketInputStream.read(SocketInputStream.java:171)
>         at java.net.SocketInputStream.read(SocketInputStream.java:141)
>         at okio.Okio$2.read(Okio.java:139)
>         at okio.AsyncTimeout$2.read(AsyncTimeout.java:237)
>         ...

0 个答案:

没有答案