[Solved] selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn

Error Messages: selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn’t exist

Traceback (most recent call last):
  File "/opt/Vcert/myVcert/vul.py", line 2, in <module>
    from selenium import webdriver
ImportError: No module named selenium
Traceback (most recent call last):
  File "/opt/Vcert/myVcert/vul.py", line 228, in <module>
    main()
  File "/opt/Vcert/myVcert/vul.py", line 44, in main
    browser = my_browser()
  File "/opt/Vcert/myVcert/vul.py", line 31, in my_browser
    browser = webdriver.Chrome(executable_path='/opt/bin/chromedriver', chrome_options=chrome_options)
  File "/opt/py3/lib64/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/opt/py3/lib64/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/opt/py3/lib64/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/opt/py3/lib64/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/opt/py3/lib64/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist

 

Solution:
1. Kill chromedriver, kill webdriver, kill chrome.
2. Add browser.close() after each browser.

Read More: