-1
from selenium import webdriver
#from webdriver_manager.chrome import ChromeDriverManager
import  time

browser=webdriver.Chrome(ChromeDriverManager().install())
#browser=webdriver.Chrome()

url="exampleurl.com"

browser.get(url)

time.sleep(10)

browser.close()

When i run this in pycharm i get error like that (selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH)

but i added driver to path but it not works why? but when i added webdriver_manager it worked but i want run this code with normal way how can i do ? THANKS...

Origami25
  • 18
  • 1
  • 5
  • Chrome driver exe is not added to your Path variable you can add it to youe path variable. or you can set the system environment variable to pick the chrome driver from specified location – Ravi May 18 '20 at 03:49
  • Hey ravi please can we talk in messenger maybe u can help me if it isnt problem for u – Origami25 May 18 '20 at 04:05
  • my english isnt good so i can send u video how i add path and i hope u can help me i m not be able to video chatting how way we implement for solve it :) – Origami25 May 18 '20 at 04:35
  • and i want ask another thing when i use webdriver manager it works this can affect me in future project example there have something that i cant do while i use webdriver manager i must use normal selenium at that time – Origami25 May 18 '20 at 04:56

2 Answers2

0

Before start navigating with Selenium, you must set executable path to your driver instance.

 driver = webdriver.Chrome('/path/to/chromedriver') 

Make sure you've downloaded the Chrome driver executable from this website.

You can test if it actually is in the PATH, if you open a cmd and type in chromedriver (assuming your chromedriver executable is still named like this) and hit Enter.

If Starting ChromeDriver 2.15.322448 is appearing, the PATH is set appropriately and there is something else going wrong.

heron J
  • 322
  • 1
  • 11
  • i write to cmd but it says to me ('chromedriver' is not recognized as an internal or external command, operable program or batch file.) but i m sure i added path i even make new one i added python;python scripts;and file way to chrome driver but in not works – Origami25 May 18 '20 at 03:56
  • If it says that it is not recognized as internal or external command its mostly because its not added to PATH variable.Please set it PATH Variable and relaunch the command prompt and run chromedriver.exe – Ravi May 18 '20 at 04:28
  • i added i follow link but i dont know it says it but i added – Origami25 May 18 '20 at 04:35
0

Please specify you path to chrome driver as shown in the below code .

import time
from selenium import webdriver

    driver = webdriver.Chrome('**/path/to/chromedriver**')  # Optional argument, if not specified will search path.
    driver.get('http://www.google.com/');
    time.sleep(5) # Let the user actually see something!
    search_box = driver.find_element_by_name('q')
    search_box.send_keys('ChromeDriver')
    search_box.submit()
    time.sleep(5) # Let the user actually see something!
    driver.quit()

or Add the path to chrome driver in the PATH Variable as shown in below links

Link1 Link2

Ravi
  • 157
  • 12