0

I've been struggling to run some tests on selenium using a docker on macOS Monterey recently. No issues with these tests on a Windows machine though, so I thought it might be somehow related to the macOS. I'm using docker-compose.

Here are some relevant error messages from the logs:

test_email-1  | --- Failed steps: 
test_email-1  |  
test_email-1  |   Scenario: Access to <edited> # features/login copy.feature:7 
test_email-1  |     When I navigate to "https://<edited>" # features/login copy.feature:9 
test_email-1  |       Error: org.openqa.selenium.NoSuchSessionException: Unable to execute request for an 
existing session: Unable to find session with ID:  
test_email-1  | Build info: version: '4.1.2', revision: '9a5a329c5a'
test_email-1  | System info: host: '9d1d3cff9e3e', ip: '172.19.0.2', os.name: 'Linux', 
os.arch: 'amd64', os.version: '5.10.76-linuxkit', java.version: '11.0.13' 
test_email-1  | Driver info: driver.version: unknown 
test_email-1  | 
test_email-1  | 1 scenarios (1 failed) 
test_email-1  | 10 steps (1 failed, 9 skipped)

For some reason, the session ID is blank.

Some notable errors in the logs from the hub:

tests-hub-1         | 10:33:35.570 WARN [SeleniumSpanExporter$1.lambda$export$0] - 
{"eventTime": 1644402815478448222,"eventName": "exception","attributes": 
{"driver.url": "<localhost url>","exception.message": "Error while creating session with the 
driver service. Stopping driver service: unknown error: DevToolsActivePort file doesn't exist\n  
(Driver info: chromedriver=98.0.4758.80 (<...>),platform=Linux 5.10.76-linuxkit x86_64) 
(WARNING: The server did not provide any stacktrace information)\n
Command duration or timeout: 60.24 seconds\n
Build info: version: '4.1.2', revision: '9a5a329c5a'\n
System info: host: '9d1d3cff9e3e', ip: '172.19.0.2', os.name: 'Linux', os.arch: 'amd64', 
os.version: '5.10.76-linuxkit', java.version: '11.0.13'\nDriver info: driver.version: unknown",
"exception.stacktrace": "org.openqa.selenium.WebDriverException: 
unknown error: DevToolsActivePort file doesn't exist\n  
<...>

What has been tried so far:

  • Updating and reinstalling selenium
  • Updating and reinstalling chromedriver
  • Restarting the docker-compose multiple times
  • Reinstalled Java
  • Checked if the ports aren't blocked
  • Tried running docker-compose and tests with and without root
  • Tried using shm_size instead of volume
  • Added these flags to chromedriver: --disable-dev-shm-usage, --no-sandbox

Perhaps anyone has any ideas of how to fix this or at least what should I look into when resolving this?

Edit: adding the docker-compose config:

version: '3'

services:
  test:
    image: <edited>:latest
    networks:
      - default
    tty: true
    volumes:
      - .:/tests
    depends_on:
      - hub
    entrypoint: "go run tests/cmd/runner"

  test_email:
    image: <edited>:latest
    networks:
      - default
    tty: true
    volumes:
      - .:/tests
    depends_on:
      - hub
    entrypoint: "go run tests/cmd/runner"

  hub:
    image: selenium/standalone-chrome:latest
    networks:
      - default
    ports:
      - "4449:4444"
      - "5900:5900"
   
networks:
  default: 
    driver: bridge

P.S. I'm still a novice in dockers and selenium, so please forgive me if I missed something important. Thanks in advance!

  • 1
    I've also noticed this error message in the hub logs: [SEVERE]: bind() failed: Cannot assign requested address (99) – 1withcheese Feb 09 '22 at 11:42
  • Update the question with your code trials – undetected Selenium Feb 09 '22 at 12:34
  • @undetectedSelenium added the docker-compose file – 1withcheese Feb 09 '22 at 12:40
  • What does _`version: '3'`_ stands for in the docker-compose config? I see you using [Selenium](https://stackoverflow.com/a/54482491/7429447) **`version: '4.1.2'`** – undetected Selenium Feb 09 '22 at 12:42
  • @undetectedSelenium it's docker-compose's version 3, example: https://github.com/SeleniumHQ/docker-selenium/blob/trunk/docker-compose-v3.yml – 1withcheese Feb 09 '22 at 12:45
  • In your `docker-compose` you have the volume with an annotation that looks for Windows. I don't know if `.:/tests` works on macOS. However, that should not be related to the problem you're seeing. – Tom Oct 05 '22 at 19:28

0 Answers0