1

I'm attempting to import WebDriverManager for Chrome, but this is what I get

$ pip install webdriver-manager                                  
Defaulting to user installation because normal site-packages is not writeable           
Requirement already satisfied: webdriver-manager in ./.local/lib/python3.10/site-packages (3.8.1)                                                                               
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from webdriver-manager) (2.25.1)                                                                     
Requirement already satisfied: python-dotenv in ./.local/lib/python3.10/site-packages (from webdriver-manager) (0.20.0) 

$ python3 Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install())) Traceback (most recent call last):
File "", line 1, in File "/home/jakob/.local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in init super().init(DesiredCapabilities.CHROME['browserName'], "goog", File "/home/jakob/.local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 92, in init super().init( File "/home/jakob/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 277, in init self.start_session(capabilities, browser_profile) File "/home/jakob/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 370, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/home/jakob/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 435, in execute self.error_handler.check_response(response) File "/home/jakob/.local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist Stacktrace: #0 0x7f04a8c85b13 #1 0x7f04a8a8c688 #2 0x7f04a8ab3b92 #3 0x7f04a8ab0035 #4 0x7f04a8aac5aa #5 0x7f04a8ae764a #6 0x7f04a8ae17a3 #7 0x7f04a8ab70ea #8 0x7f04a8ab8225 #9 0x7f04a8ccd2dd #10 0x7f04a8cd12c7 #11 0x7f04a8cb722e #12 0x7f04a8cd20a8 #13 0x7f04a8cabbc0 #14 0x7f04a8cee6c8 #15 0x7f04a8cee848 #16 0x7f04a8d08c0d #17 0x7f04a8064b43

I cannot get an instance of Chrome up and running where as I have google-chrome-stable (103.0.5060.114-1) installed.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
javery1337
  • 23
  • 5

1 Answers1

0

Possibly there are multiple versions of Python involved. So it would be much safer to invoke pip via the exec module approach, so you are aware about the desired Python executable version.

You can follow the below steps:

  • (optional) Uninstall the previously installed python3 and install a fresh version of python3.

  • Install Selenium

    pip3 install -U selenium
    
  • Install Webdriver Manager for Python

    pip3 install webdriver-manager
    

References

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • So I actually solved it by inputting the following: driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install())) – javery1337 Jul 22 '22 at 20:25
  • In the question you mentioned that the error was in this line only `driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))` – undetected Selenium Jul 22 '22 at 20:32