Docker&Selenium无法连接到渲染器

我正在尝试安装浏览器testing与selenium和docker与behat。

我所遇到的主要问题是运行testing时的可靠性。

有时候我可以联系起来,能够正常运行testing,但是很多时候我不能。

这似乎很不一致,我启动容器和运行testing,第一次失败,再次运行,第二次运行,并正常工作。

一旦我重新启动selenium毂,再次运行testing,很好(主要)。

谢谢您的帮助。

我得到一个常见的错误是:

Could not open connection: session not created exception from disconnected: unable to connect to renderer (Session info: chrome=61.0.3163.91) (Driver info: chromedriver=2.32.498513 (2c63aa53b2c658de596ed550eb5267ec5967b351),platform=Linux 4.4.0-96-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 411 milliseconds Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z' System info: host: 'e0218fe24a14', ip: '172.18.0.6', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-96-generic', java.version: '1.8.0_131' Driver info: driver.version: unknown (Behat\Mink\Exception\DriverException) 

泊坞窗,compose.yml

 version: '2' services: db: build: context: . dockerfile: DockerfileDb container_name: db ports: - "3396:3306" environment: - MYSQL_ROOT_PASSWORD=password web: build: context: . dockerfile: DockerfileWeb depends_on: - db container_name: web ports: - "8080:80" links: - db - selenium-hub environment: - LOCALHOST_DOCKER=db - MYSQL_USER=root - MYSQL_PASSWORD=password volumes: - ./conf/rsyslog.conf:/etc/rsyslog.d/rsyslog-custom.conf - ./:/var/www - ./sites-enabled:/etc/apache2/sites-enabled - ./conf/hosts:/etc/hosts selenium-hub: container_name: selenium_hub image: selenium/hub ports: - "4444:4444" chrome: container_name: selenium_node_chrome image: selenium/node-chrome volumes: - /dev/shm:/dev/shm # Mitigates the Chromium issue described at https://code.google.com/p/chromium/issues/detail?id=519952 links: - selenium-hub - web environment: - HUB_PORT_4444_TCP_ADDR=selenium-hub - HUB_PORT_4444_TCP_PORT=4444 volumes: - ./conf/hosts_selenium:/etc/hosts depends_on: - selenium-hub shm_size: 1g firefox: container_name: selenium_node_firefox image: selenium/node-firefox links: - selenium-hub - web environment: - HUB_PORT_4444_TCP_ADDR=selenium-hub - HUB_PORT_4444_TCP_PORT=4444 volumes: - ./conf/hosts_selenium:/etc/hosts depends_on: - selenium-hub 

behat.yml

 default: extensions: Laracasts\Behat: # env_path: .env.behat Behat\MinkExtension: base_url: http://**********:8080/ default_session: laravel laravel: ~ selenium2: wd_host: http://selenium_node_chrome:5555/wd/hub capabilities: {'platform': 'LINUX', 'browser': 'chrome'} browser_name: chrome 

login.feature

 @mink:selenium2 Feature: login Users should be able to login Scenario: Login Successfully # features/Login.feature:5 When I wait 1 seconds # FeatureContext::iWaitSeconds() Could not open connection: session not created exception from disconnected: unable to connect to renderer (Session info: chrome=61.0.3163.91) (Driver info: chromedriver=2.32.498513 (2c63aa53b2c658de596ed550eb5267ec5967b351),platform=Linux 4.4.0-96-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 411 milliseconds Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z' System info: host: 'e0218fe24a14', ip: '172.18.0.6', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-96-generic', java.version: '1.8.0_131' Driver info: driver.version: unknown (Behat\Mink\Exception\DriverException) Given I am on "/" # FeatureContext::visit() Then print current URL # FeatureContext::printCurrentUrl() Then take screenshot "test1.png" # FeatureContext::takeScreenshot() Then I should not see "Whoops" # FeatureContext::assertPageNotContainsText() And I should not see "ERR_NAME_NOT_RESOLVED" # FeatureContext::assertPageNotContainsText() Then take screenshot "login_test.png" 

您可以尝试将Chrome驱动程序更新到最新版本,它适用于我: https : //sites.google.com/a/chromium.org/chromedriver/downloads