Tag Archives: DevToolsActivePort file doesn‘t exis

[Solved] unknown error: DevToolsActivePort file doesn‘t exis

Scene

When using selenium, an error is reported one day, as shown in the title, and the code is as follows:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

option = Options()
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-shm-usage')

browser = webdriver.Chrome('./chromedriver',chrome_options=option)

browser.get('http://www.baidu.com/')
print(browser.title)
browser.quit()  

Solution:

First, ensure that the versions of Google Chrome and chrome River are consistent. If you are sure to be consistent, skip the following three steps.

    1. View Google Chrome version command:
google-chrome --version

I’m not sure about the command to view the chrome River version, but if you find the Google Chrome version, you can go to the following website to download the corresponding chrome river. If the versions are inconsistent, you need to download the consistent version from the download location

    1. google-chrome: http://dist.control.lth.se/public/CentOS-7/x86_64/google.x86_64/chromedriver: https://sites.google.com/a/chromium.org/chromedriver/downloads

Then the solution is to add an option

option.add_argument("--remote-debugging-port=9222")  # this