skip to Main Content

I’m struggling with this error:

(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

while using selenium module on my Ubuntu-server 22.04. The thing is that the same code works fine on my local PC with the same Ubuntu version.

For avoiding trivial questions:

  • driver location and binary location are correct
  • I use –headless mode
  • I have the same versions of google-chrome and chromedriver

Code:

# initial settings for selenium
driver_location = '/usr/bin/chromedriver'
binary_location = '/usr/bin/google-chrome'

options = Options()
options.binary_location = binary_location
options.add_argument('--headless')

service = Service(driver_location)
driver = webdriver.Chrome(service=service, options=options)

And again, I think I need somehow use the fact that this code works on my local PC. Maybe you guys can advise me what to check…

2

Answers


  1. Replace:

    options.add_argument('--headless')
    

    with:

    options.add_argument(''--headless=new'')
    

    and execute your test.

    See: DeprecationWarning: headless property is deprecated, instead use add_argument(‘–headless’) or add_argument(‘–headless=new’) on Selenium 4.8.0 Python

    Login or Signup to reply.
  2. I had the same issue with both chrome and edge in Ubuntu. I removed both chrome and edge and reinstalled edge. It could be caused by driver version.

    This is what worked for me:

    from webdriver_manager.microsoft import EdgeChromiumDriverManager
    
    edge_options = Options()
    edge_options.add_argument('user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36')
    edge_options.add_argument("--headless")    
    edge_options.binary_location='/usr/bin/microsoft-edge'
    
    driver = webdriver.Edge(service=Service(EdgeChromiumDriverManager().install()),options=edge_options)
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search