-2
from selenium import webdriver  
driver = webdriver.Chrome()  
driver = webdriver.Chrome(
    r'C:\Users\New User prof\Downloads\chromedriver_win32.zip\chromedriver.exe')
driver.get(
    "https://www.google.com/webmasters/tools/url-removal?hl=en&siteUrl=https://www.greatbuyz.com/&mesd=AB9YKzIL4DBt4yX8SVayjC2kUq8yeXctK_u2WGH4KlESTcjXkcOsdBvVP7TnX4S4bBF4PADFQzZAxIqcxMiVerW67kTw-UGIWjHVftlzX5DNcJjm3Uz5wBpWxkDYY7IIFlVMdiEvTsAG_GwgA_DqO7Exg5w80HGHX_lk4okr-Ay7vrCG63zKVLrMGmyNMUPGEESjX2rJF-Xx&authuser=2")

driver.find_element_by_xpath(
    "//button[@class='goog-inline-block jfk-button jfk-button-standard']").click()

Error:

Traceback (most recent call last):
  File "/root/pythonnk/my_env/lib64/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/usr/lib64/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver': 'chromedriver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bot.py", line 4, in <module>
    driver = webdriver.Chrome()
  File "/root/pythonnk/my_env/lib64/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/root/pythonnk/my_env/lib64/python3.6/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
halfer
  • 19,824
  • 17
  • 99
  • 186
  • Is that a zip file `\chromedriver_win32.zip\chromedriver.exe` ? I don't know if that is the correct way to address it. Maybe you need to extract it first? – Ralf Dec 22 '18 at 13:19
  • In error log, `Message: 'chromedriver' executable needs to be in PATH.` – Geno Chen Dec 22 '18 at 13:22
  • Now i changed it to extracted file, but still its not working. – Naveen Nk Dec 22 '18 at 13:34
  • Possible duplicate of [Error message: "'chromedriver' executable needs to be available in the path"](https://stackoverflow.com/questions/29858752/error-message-chromedriver-executable-needs-to-be-available-in-the-path) – Soumendra Dec 22 '18 at 16:26
  • Welcome to Stackoverfloe Naveen. Please look into https://stackoverflow.com/questions/29858752/error-message-chromedriver-executable-needs-to-be-available-in-the-path – Soumendra Dec 22 '18 at 16:26

2 Answers2

0

I am not cent percent sure this is the problem. If there are spaces in your path, sometimes the path is not recognized in windows. You can try adding additional double quotes around your path like this.

driver = webdriver.Chrome(
    r'"C:\Users\New User prof\Downloads\chromedriver_win32.zip\chromedriver.exe"')

I can't confirm weather it needs to be extracted. I am not using windows right now so can't test.

nandu kk
  • 368
  • 1
  • 10
0
  1. Make sure you extract the zip file before you use it and provide that extracted file path.
  2. Use forward slash while giving the path.
  3. Try the code below

    from selenium import webdriver 
    driver = webdriver.Chrome(
       'C:/Users/New User prof/Downloads/chromedriver_win32.zip/chromedriver.exe')
    driver.get("URL")
    driver.find_element_by_xpath("//button[@class='goog-inline-block jfk-button jfk-  button-standard']").click()
    
halfer
  • 19,824
  • 17
  • 99
  • 186