Answer the question
In order to leave comments, you need to log in
How to run chromium via selenium-python?
I want to run selenium through chromium. I wrote such code.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("start-maximized")
options.add_argument("disable-infobars")
options.add_argument("--disable-extensions")
options.add_argument("--disable-gpu")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--no-sandbox")
options.binary_location = "/snap/bin/chromium"
driver = webdriver.Chrome(chrome_options=options)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
Stacktrace:
#0 0x55efd7355a23 <unknown>
#1 0x55efd6e20e18 <unknown>
#2 0x55efd6e46e12 <unknown>
Answer the question
In order to leave comments, you need to log in
the reason in snap
error is known
DevToolsActivePort file doesn't exist is caused when chrome is unable to find its reference in scoped_dirXXXXX folder.
two exits
1 . install just as an application and everything will go
2. add two options
homedir = getenv('HOME')
options.add_argument('--user-data-dir="{}"'.format(homedir))
options.add_argument('--remote-debugging-port=9222')
HOME
, correct it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question