Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

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.

question from:https://stackoverflow.com/questions/65871342/selenium-webdriverexception-devtoolsactiveport-file-doesnt-exist-chromium-bro

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Have you seen the answer at https://stackoverflow.com/a/56638103/12570861 ?

Try adding the argument --remote-debugging-port=<port>


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...