'Selenium WebDriverException: DevToolsActivePort file doesn't exist (Chromium browser)
I've seen the DevToolsActivePort error come up in a couple of StackOverflow posts, but not of the fixes for those have worked for me. I'm using a Chromium browser (as opposed to Google Chrome), so that might be where I'm running into issues?
This is my code:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import ChromeType
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--headless')
... # plus other options, but the above 3 seem to have solved the issue for other users
options.binary_location = '/usr/bin/chromium-browser'
driver = webdriver.Chrome(ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install(),chrome_options=options)
I'm using ChromeDriverManager to avoid problems with chromedriver version compatibility.
This gives the error selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
.
Any pointers on what might be causing the issue are appreciated.
Solution 1:[1]
Have you seen the answer at https://stackoverflow.com/a/56638103/12570861 ?
Try adding the argument --remote-debugging-port=<port>
Solution 2:[2]
I was getting this error after upgrading my chromedriver version to 86 and Python runtime to 3.8 from 3.6 on AWS Lambda (Amazon Linux 2) run in a docker container. I played whack a mole for hours with chrome/chromedriver starting issues.
Eventually I found this actively maintained min miplementation of python+selenium+docker. https://github.com/umihico/docker-selenium-lambda/ The setup in their Dockerfile and test.py chrome_options worked.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | tbandjellyfish |
Solution 2 |