Prasun Jain
Prasun Jain

Reputation: 39

chromedriver using selenium for scraping

I am trying to load chrome web driver using selenium in command but getting an error

1)I have updated my chrome browser and webdriver to the latest version 2)checked by using the same version of chrome browser and driver

from selenium import webdriver
driver=webdriver.Chrome('C:/Users/prasun.j/Desktop/chromedriver')

I expect to pop up a browser window but getting this error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\prasun.j\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "C:\Users\prasun.j\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\prasun.j\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\prasun.j\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\prasun.j\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: failed to write automation extension zip
  (Driver info: chromedriver=73.0.3683.20 (8e2b610813e167eee3619ac4ce6e42e3ec622017),platform=Windows NT 10.0.14393 x86_64)

Upvotes: 0

Views: 1943

Answers (1)

dpapadopoulos
dpapadopoulos

Reputation: 1846

Notes:

  • Be sure that you have already installed the selenium package
  • Download chromedriver.exe from here (newest version - 73+) and insert it in your code (be sure that is unzipped).
  • Also, replace "/" with "\\".
  • Install the proper Chrome driver (73+) so to be combined with chromedriver version (73+ too)
  • Check the answer below ...

This is from the the official Chrome Driver website:

enter image description here

Proper usage:

driver=webdriver.Chrome('C:\\User\\prasun.j\\Desktop\\chromedriver.exe')

# or as @MosheSlavin answered 

driver=webdriver.Chrome(r'C:\Users\prasun.j\Desktop\chromedriver.exe')

Upvotes: 3

Related Questions