最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

drupal - BehatSelenium Could not open connection: Could not start a new session. New session request timed out - Stack Overflow

programmeradmin3浏览0评论

I am having issues getting behat to work with Drupal 10 in a lando environment. I realize I'm using Selenium 4, and my config says Selenium 2. I tried to update it, without any luck and I read that you can still keep selenium2 in the config files, and it should be ok.

I'm not sure if that's true and have trouble changing my behat file to use selenium4.

In the selenium UI, the session opens up when I run a test but there are no capabilities. I've uploaded a couple of images from selenium where the capabilities are empty, running at:

http://chromedriver/ http://localhost:4444/ui/#

This is the error I am getting after running a test. The session times out.

Pinging this in the lando server, and from the host does nothing. It just hangs.

172.23.0.10

Please make sure that Selenium server is running. Could not open connection: Could not start a new session. New session request timed out ╳ Host info: host: '75de9130cd1b', ip: '172.23.0.10' ╳ Build info: version: '4.20.0', revision: '866c76ca80' ╳ System info: os.name: 'Linux', os.arch: 'aarch64', os.version: '6.12.5-linuxkit', java.version: '17.0.11' ╳ Driver info: driver.version: unknown (RuntimeException)

Error from Docker

This is the error from the chromedriver in docker.


2025-02-18 13:02:13 18:02:13.777 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "c4ce3313d54e4a96979b3d609b0ef675","eventTime": 1739901733776864463,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": ".openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue","http.host": "chromedriver:4444","http.method": "POST","http.request_content_length": "160","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession"}}
2025-02-18 13:02:13

Driver versions

  • Selenium Standalone Version: 4.20.0
  • ChromeDriver: 124.0.6367.78
    • built on Debian trixie/sid, running on Debian 12.5
  • Chrome Browser Version: 124.0
    • Binary Path: /usr/bin/chromium

When I navigate here, I can see the UI: http://localhost:4444/ui/#

The UI tells me that the URI is: http://172.23.0.10:4444

This is what I get when I do lando info

service: 'chromedriver',
urls: [ 'http://chromedriver/' ],
type: 'compose',
healthy: 'unknown',
config: {},
version: 'custom',
meUser: 'www-data',
hasCerts: false,
api: 3,
hostnames: [ 'chromedriver.example.internal' ],
hostname: [] },

my behat file

default:
  suites:
    default:
      filters:
        tags: "~@fullDb&&~fullDB&&~@wip&&~@local"
      contexts:
        - Drupal\CaptureHtmlOnFailure
        - Drupal\EntityContext
        - Drupal\ElementContext
        - Drupal\FeatureContext
        - Drupal\GeneralContext
        - Drupal\MediaContext
        - Drupal\MetaTagsContext
        - Drupal\TranslationContext
        - Drupal\WysiwygContext
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MinkContext
        - Drupal\DrupalExtension\Context\MessageContext
        - Drupal\DrupalExtension\Context\DrushContext
        - FailAid\Context\FailureContext
      paths:
        - "%paths.base%/features"
  extensions:
    Drupal\MinkExtension:
      ajax_timeout: '5'
    Drupal\DrupalExtension:
      drupal:
        drupal_root: /app/web
      blackbox: ~
      api_driver: "drupal"
      drush:
        alias: '@self'
        binary: '/var/www/html/vendor/bin/drush'
        root: '/app/web'
      region_map:
        messages: "div[data-drupal-messages]"
        language switcher: ".node-language-switcher"
        tabs: "#block-tabs, nav.tabs-wrapper ul.tabs"
        right column of the 2 column admin layout section: ".layout--twocol-section--25-75 .layout__region--second"
        layout builder block configuration popup: ".layout-builder-configure-block"
        right layout admin panel: ".ui-dialog-off-canvas"
        modal: "div[aria-describedby='drupal-modal']"
        media modal tabs: "div[aria-describedby='drupal-modal'] ul.media-library-menu"
        toolbar: "nav .toolbar-menu-administration"
    DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~
    Behat\MinkExtension:
      browser_name: chrome
      javascript_session: default
      files_path: "%paths.base%/media"
      base_url: /
      show_cmd: "open %s"
      sessions:
        default:
          selenium2:
            wd_host: http://chromedriver:4444
            browser: chrome
            capabilities:
              browserName: chrome
              chrome:
                switches:
                  - "--no-sandbox"
                  - "--headless"
                  - "--disable-gpu"
                  - "--window-size=428,845"
                  - "--ignore-certificate-errors"
                  - "--disable-dev-shm-usage"
    FailAid\Extension:
      screenshot:
        directory: '/var/www/html/tests/behat/screenshots'
        mode: png
        autoClean: false

I am having issues getting behat to work with Drupal 10 in a lando environment. I realize I'm using Selenium 4, and my config says Selenium 2. I tried to update it, without any luck and I read that you can still keep selenium2 in the config files, and it should be ok.

I'm not sure if that's true and have trouble changing my behat file to use selenium4.

In the selenium UI, the session opens up when I run a test but there are no capabilities. I've uploaded a couple of images from selenium where the capabilities are empty, running at:

http://chromedriver/ http://localhost:4444/ui/#

This is the error I am getting after running a test. The session times out.

Pinging this in the lando server, and from the host does nothing. It just hangs.

172.23.0.10

Please make sure that Selenium server is running. Could not open connection: Could not start a new session. New session request timed out ╳ Host info: host: '75de9130cd1b', ip: '172.23.0.10' ╳ Build info: version: '4.20.0', revision: '866c76ca80' ╳ System info: os.name: 'Linux', os.arch: 'aarch64', os.version: '6.12.5-linuxkit', java.version: '17.0.11' ╳ Driver info: driver.version: unknown (RuntimeException)

Error from Docker

This is the error from the chromedriver in docker.


2025-02-18 13:02:13 18:02:13.777 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "c4ce3313d54e4a96979b3d609b0ef675","eventTime": 1739901733776864463,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": ".openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue","http.host": "chromedriver:4444","http.method": "POST","http.request_content_length": "160","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession"}}
2025-02-18 13:02:13

Driver versions

  • Selenium Standalone Version: 4.20.0
  • ChromeDriver: 124.0.6367.78
    • built on Debian trixie/sid, running on Debian 12.5
  • Chrome Browser Version: 124.0
    • Binary Path: /usr/bin/chromium

When I navigate here, I can see the UI: http://localhost:4444/ui/#

The UI tells me that the URI is: http://172.23.0.10:4444

This is what I get when I do lando info

service: 'chromedriver',
urls: [ 'http://chromedriver/' ],
type: 'compose',
healthy: 'unknown',
config: {},
version: 'custom',
meUser: 'www-data',
hasCerts: false,
api: 3,
hostnames: [ 'chromedriver.example.internal' ],
hostname: [] },

my behat file

default:
  suites:
    default:
      filters:
        tags: "~@fullDb&&~fullDB&&~@wip&&~@local"
      contexts:
        - Drupal\CaptureHtmlOnFailure
        - Drupal\EntityContext
        - Drupal\ElementContext
        - Drupal\FeatureContext
        - Drupal\GeneralContext
        - Drupal\MediaContext
        - Drupal\MetaTagsContext
        - Drupal\TranslationContext
        - Drupal\WysiwygContext
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MinkContext
        - Drupal\DrupalExtension\Context\MessageContext
        - Drupal\DrupalExtension\Context\DrushContext
        - FailAid\Context\FailureContext
      paths:
        - "%paths.base%/features"
  extensions:
    Drupal\MinkExtension:
      ajax_timeout: '5'
    Drupal\DrupalExtension:
      drupal:
        drupal_root: /app/web
      blackbox: ~
      api_driver: "drupal"
      drush:
        alias: '@self'
        binary: '/var/www/html/vendor/bin/drush'
        root: '/app/web'
      region_map:
        messages: "div[data-drupal-messages]"
        language switcher: ".node-language-switcher"
        tabs: "#block-tabs, nav.tabs-wrapper ul.tabs"
        right column of the 2 column admin layout section: ".layout--twocol-section--25-75 .layout__region--second"
        layout builder block configuration popup: ".layout-builder-configure-block"
        right layout admin panel: ".ui-dialog-off-canvas"
        modal: "div[aria-describedby='drupal-modal']"
        media modal tabs: "div[aria-describedby='drupal-modal'] ul.media-library-menu"
        toolbar: "nav .toolbar-menu-administration"
    DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~
    Behat\MinkExtension:
      browser_name: chrome
      javascript_session: default
      files_path: "%paths.base%/media"
      base_url: https://example/
      show_cmd: "open %s"
      sessions:
        default:
          selenium2:
            wd_host: http://chromedriver:4444
            browser: chrome
            capabilities:
              browserName: chrome
              chrome:
                switches:
                  - "--no-sandbox"
                  - "--headless"
                  - "--disable-gpu"
                  - "--window-size=428,845"
                  - "--ignore-certificate-errors"
                  - "--disable-dev-shm-usage"
    FailAid\Extension:
      screenshot:
        directory: '/var/www/html/tests/behat/screenshots'
        mode: png
        autoClean: false

Share Improve this question edited yesterday phpwebdev asked yesterday phpwebdevphpwebdev 1031 gold badge1 silver badge10 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

After hours of messing around with this, I finally tried downgrading. I downgraded to 4.1.4 from 4.2.0 and it's working now! I hope this helps anyone else stuck on this.

seleniarm/standalone-chromium:4.1.4-20220429

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论