How to run "selenium==4.0.0b2.post1" remote-driver on docker

272 Views Asked by At

I am currently trying to run Selenium Remote driver, version selenium==4.0.0b2.post1 on docker-compose in the port 6900.

I can currently connect to selenium grid, but I cannot run the remote webdriver.

My dockerfile is:

# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down`
version: "3"
services:
  chrome:
    image: selenium/node-chrome:4.0.0-beta-3-prerelease-20210319
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium-hub
    environment:
      - JAVA_OPTS=-Dwebdriver.chrome.whitelistedIps=
      - 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-beta-3-prerelease-20210319
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
    environment:
      - JAVA_OPTS=-Dwebdriver.chrome.whitelistedIps=

and I am trying to connect to Selenium by using the following code: Important: selenium version is 4.0.0b2.post1, I can make it work with selenium 3.1... but I need some SE4 features

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium import webdriver


driver = webdriver.Remote(
    command_executor='http://localhost:4444/wd/hub',
    desired_capabilities=DesiredCapabilities.CHROME
)

driver.get('http://www.google.com/')

Notice that the error I get in the docker console is the following:

INFO [Distributor.newSession] - Session created by the distributor. Id: e9616d2cad52fwerwefbab0c4b09f08, Caps: Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 89.0.4389.90, chrome: {chromedriverVersion: 89.0.4389.23 (61b08ee2c5002..., userDataDir: /tmp/.com.google.Chrome.4fUoUu}, goog:chromeOptions: {debuggerAddress: localhost:42915}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: {}, se:cdp: http://172.23.0.3:5555/sess..., setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
0

There are 0 best solutions below