0

Tried executing

from selenium import webdriver

browser=webdriver.Chrome()

browser.get('http://www.google.com')

but doesn't execute and throws error

=RESTART: C:\Users\Phani\AppData\Local\Programs\Python\Python37-32\drive.py =
Traceback (most recent call last):
  File "C:\Users\Phani\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
    stdin=PIPE)
  File "C:\Users\Phani\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Phani\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Phani\AppData\Local\Programs\Python\Python37-32\drive.py", line 4, in <module>
    browser=webdriver.Chrome()
  File "C:\Users\Phani\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\Phani\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py", line 83, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

properly installed selenium using pip install

Please Help!!

1

3 Answers 3

1

This isn't working because you haven't provide path of the chrome driver.WebDriver doesn't know where is the chromedriver path.

driver = webdriver.Chrome("path of the chrome driver Chromedriver.exe")

for example:

from selenium import webdriver
driver = webdriver.Chrome("d:/chromedriver/Chromedriver.exe")
driver.get("https://www.google.com")
Sign up to request clarification or add additional context in comments.

Comments

1

You can try Firefox for this purpose:

First Download Geckodriver from here: https://github.com/mozilla/geckodriver/releases/tag/v0.24.0

from selenium import webdriver
fox = webdriver.Firefox(executable_path='/path/to/downloaded/gecko/driver')
fox.get("https://www.google.com")

Same could be done with google chrome :

You can download chrome driver from here:

https://sites.google.com/a/chromium.org/chromedriver/home

No need to setup PATH variable.

Comments

0

I have just fixed the issue. You need to download an updated version of Google Chrome. For instance, my old version was 96 but now it is 101. That is it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.