硒与behat:无法找到会话提供者

问题描述

因此,我试图在docker容器中配置硒,以便与behat一起使用,并且当我到达http:// localhost:4444 / status时,集线器的状态尚未就绪:

    template <typename RandomNumberdistribution>
        requires(invocable_with_result<T,RandomNumberdistribution,rnd_eng&>)
    void init_Random(rnd_eng,RandomNumberdistribution& dist)

当我运行测试时:

{
  "value": {
    "ready": false,"message": "Selenium Grid not ready.","nodes": [
      {
        "id": "f746de23-58e4-499d-85fd-9bad4f904488","uri": "http:\u002f\u002f172.22.0.5:5555","maxSessions": 2,"stereotypes": [
          {
            "capabilities": {
              "browserName": "chrome"
            },"count": 2
          }
        ],"sessions": [
        ]
      }
    ]
  }
}

我尝试了许多配置,主要是在behat.yml的wd_host参数中,但是我尝试的所有操作(不同的url,不同的端口...)都给我带来了错误

我的docker-composer.yml:

Could not open connection: Payload received from webdriver is valid but unexpected json: {
        "value": {
          "error": "session not created","message": "Unable to find provider for session: Capabilities {browser: firefox,browserName: chrome,ignoreZoomSetting: false,name: Behat feature suite,tags: [509f70556c1c,PHP 7.4.9]},Capabilities {browserName: chrome},Capabilities {browserName: firefox},Capabilities {}\nBuild info: version: '4.0.0-alpha-7',revision: '117b9d61c9'\nSystem info: host: '7f39dcd595c7',ip: '172.22.0.2',os.name: 'Linux',os.arch: 'amd64',os.version: '4.19.76-linuxkit',java.version: '1.8.0_265'\nDriver info: driver.version: unkNown","stacktrace": "org.openqa.selenium.SessionNotCreatedException: Unable to find provider for session: Capabilities {browser: firefox,revision: '117b9d61c9'\nSystem info: host: '7 (Behat\Mink\Exception\DriverException)

我的behat.yml:

version: '3'

services:
  chrome:
    image: selenium/node-chrome:4.0.0-alpha-7-prerelease-20200907
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "6900:5900"

  selenium-hub:
    image: selenium/hub:4.0.0-alpha-7-prerelease-20200907
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
    restart: always

有一会儿我以为它与“ capabilities”参数有关,因此我尝试将其放入其中,但它并没有改变任何东西,而且我想如果仅仅是那样,中心仍然会告诉我它准备好了。

有什么主意吗?谢谢

解决方法

我使它与以前的版本一起使用铬硒/node-chrome:3.141.59-oxygen的图像。 而且,我必须在behat.yml中将web服务器的容器“ url”更改为base_url。 (http:// nginx是我的情况)