Artur Podlesniy
Artur Podlesniy

Reputation: 155

Having trouble opening chrome through selenium

Already installed chromedriver but for some reason keep getting this issue on my new computer when running this code I get this error message:

import requests, bs4, sys, webbrowser, random, pyperclip, re, time
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
browser = webdriver.Chrome()


   Traceback (most recent call last):
      File "C:\Users\Arthur\Downloads\file.py", line 3, in <module>
        from webdriver_manager.chrome import ChromeDriverManager
    ModuleNotFoundError: No module named 'webdriver_manager'

New Error message:

Traceback (most recent call last):
  File "C:\Users\Arthur\Downloads\fantasyfeeder.py", line 6, in <module>
    browser = webdriver.Chrome()
  File "C:\Users\Arthur\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\Arthur\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Upvotes: 1

Views: 758

Answers (2)

nonamer92
nonamer92

Reputation: 1917

I have checked it, and only after installing webdriver_manager - it works fine.

did you install webdriver_manager?

you can use it with pip:

pip install webdriver_manager

After you edited your question, you can find your solution for the second problem here:

https://stackoverflow.com/questions/29858752/error-message-chromedriver-executable-needs-to-be-available-in-the-path

Upvotes: 1

Seb
Seb

Reputation: 4576

Your code tries to import the package called webdriver_manager. I'm assuming it is this one. Have you tried installing it?

pip install webdriver_manager

Edit regarding your new error message: Your system needs to know where to locate the chromedriver.exe. You could put it into a directory that is in your system's PATH variable, or just tell the constructor where it is:

browser = webdriver.Chrome('C:\\path\\to\\chromedriver.exe')

Upvotes: 0

Related Questions