docker-robot-framework icon indicating copy to clipboard operation
docker-robot-framework copied to clipboard

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.

Open abirlal opened this issue 4 years ago • 7 comments

After Selecting BROWSER=chrome getting error. Need help on it


Visit Google | FAIL | WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/lib/chromium/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Thanks in advance..!!

abirlal avatar Jan 18 '21 16:01 abirlal

Do the logs show any specific message detailing the problem? You can view the logs by following the Troubleshooting section in the README.

ppodgorsek avatar Jan 28 '21 10:01 ppodgorsek

What is the status of this issue? Has it been resolved and can it be closed?

ppodgorsek avatar Mar 30 '21 09:03 ppodgorsek

~~Having the same issue, log folder stays empty.~~

Fixed it by making sure to chmod +x the .sh files

mikevromen avatar May 03 '21 11:05 mikevromen

Hey all

Unfortunately I'm also encountering the same issue on both browser library and selenium library. The error above occurs only if browser chosen is chrome. Firefox works fine for both libraries.

Browser Library image

Selenium Library image

I built the docker image and ran the container on an M1 ARM Macbook Pro. So far this this the only machine that i've tested on and most of my friends and work mates also use this machine so i'm not able to test this out on a x86/linux/amd64 machine.I would appreciate if anyone could take the time to let me know if they are also facing the same issue as well!

I've already tried changing the shm-size to a larger value as well.

I am hoping to completely rely on docker fully and not have to install any dependencies locally on my machine.

Any help, explanation and advice would be appreciated! I've been thinking about this problem for days now.

Abdulhakimsg avatar Jun 23 '22 14:06 Abdulhakimsg

Do the Chrome logs show any specific message detailing the problem? Could you post them here please? You can view the logs by following the Troubleshooting section in the README.

ppodgorsek avatar Jul 01 '22 07:07 ppodgorsek

Thank you for your reply @ppodgorsek. Hoping this would help those who encounter this issue as well.

So i've managed to make it work. The issue lies with webdriver not being able to communicate with chrome as i'm running an M1 Arm mac. You cannot use the official selenium or chrome image. you have to use the arm64 compatible image from the link below

  • https://github.com/seleniumhq-community/docker-seleniarm

To solve this, what i did was to run a standalone seleniarm-chrome docker container

# in shell/terminal

# Run Selenium Server with Chromium in standalone mode
docker run --name seleniarm-chromium --rm -it -p 4444:4444 -p 5900:5900 -p 7900:7900 --shm-size 3g seleniarm/standalone-chromium:latest

After wards in my test, i have a condition that if i'm running my test locally on chrome, i will connect to that arm64 chromium selenium server. Else, i'll just rely on firefox running in the docker container.

// test.robot

*** Settings ***
Library			SeleniumLibrary

*** Variables ***
${BROWSER}    %{E2E_BROWSER}
${ENV}    %{APP_ENV}

*** Test Cases ***
Determine mode
	IF	"${BROWSER}" == 'chrome' and "${ENV}" == 'testing'
        ${chrome_options} =     Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver
        Call Method    ${chrome_options}   add_argument    headless
        Call Method    ${chrome_options}   add_argument    disable-gpu
        ${options}    Call Method     ${chrome_options}    to_capabilities
        ${orig timeout} =	Set Selenium Timeout	15 seconds
        Open Browser    https://www.google.com    browser=${BROWSER}    remote_url=http://172.17.0.2:4444     desired_capabilities=${options}
	ELSE
        Open Browser    https://www.yahoo.com		${BROWSER}
	END

Capture SS
    Capture Page Screenshot
    Close Browser
# in shell/terminal
#Run e2e test
docker run --rm --platform linux/amd64 --name e2e-test --env-file .env.testing \
-v `pwd`/e2e/reports:/opt/robotframework/reports:Z \
-v `pwd`/e2e:/opt/robotframework/tests:Z \
ppodgorsek/robot-framework:latest

This whole M1 Arm mac unable to run webdriver/chromium issue is documented in the links below

  • https://stackoverflow.com/questions/69784773/headless-chrome-on-docker-m1-error-unable-to-discover-open-window-in-chrome
  • https://stackoverflow.com/questions/71165982/cannot-run-selenium-chromedriver-on-m1-mac
  • https://github.com/SeleniumHQ/docker-selenium/issues/1076
  • https://github.com/SeleniumHQ/selenium/issues/9733

This workflow is working for me. Would it be possible for users to choose to download selenium NOT using the official docker image but from the docker-seleniarm image instead?

Abdulhakimsg avatar Jul 01 '22 13:07 Abdulhakimsg

A few notes for those that run into this, and clarifications from what are above:

  • ARM Mac (M1, M2- and presumably future Chipsets) will not work properly, even if when on docker locally. I had to use a remove server.
  • If you are using selenium 4.0+ you may run into this issue depending on what you are trying to do and with what stack. I found that I had to move to an earlier release to get my code working properly.

Hope this helps.

leiforion avatar Aug 27 '23 13:08 leiforion