-3

When I tried to run the following command in python/Selenium from selenium

import webdriver

browser=webdriver.Chrome("C:\chromedriver.exe")

the below exception is thrown: selenium.common.exceptions.WebDriverException: Message: unknown error: failed to write automation extension zip

Hassan Radi
  • 936
  • 10
  • 22
Mehedi
  • 1
  • 2
  • Probably a permission issue – Amir Hajiha Mar 29 '18 at 11:50
  • 4
    try with `browser=webdriver.Chrome("C:\\chromedriver.exe")`. Also sometimes file dont work in root driver. Move it to a folder and then try – Tarun Lalwani Mar 29 '18 at 11:50
  • Possible duplicate of [Error:cannot get automation extension for chrome with selenium](https://stackoverflow.com/questions/42979877/chrome-org-openqa-selenium-webdriverexception-unknown-error-cannot-get-autom) – undetected Selenium Mar 29 '18 at 12:57

2 Answers2

0

Please put your chromedriver.exe in a folder in your desktop.

Then create a test.py in the same folder containing this minimal example:

from selenium import webdriver
browser = webdriver.Chrome()
browser.get('https://www.google.com')

This code was just tested on my Windows PC, works perfectly.

If you do not specify a path for chromedriver.exe Selenium will search for it in the same folder of your script.

I like this behaviour because if I need to move the script to another pc or send it to someone I just have to zip the folder and send it out.

You can clearly choose a different path for your chromedriver.exe file but you have to be sure that your user (or the user that will be running your script) 100% has permission to read and write for the specified path.

C:\ is generally not a good idea, specially in new Windows versions like 10.

The error you have pasted underlines a permission problem for the path C:\

Pitto
  • 8,229
  • 3
  • 42
  • 51
0

Antivirus blocked chromedriver.exe from running, disabling antivirus resolved my problem.