Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading of unpacked extensions is disabled by administrator

I am using Selenium and Chrome. As soon as I try to open automatically a webpage I get the error: Error Message

There are some answers on stackexchange on how to solve this issue in Java/C++ but I could not find any relating to Python. See for example Loading of unpacked extensions is disabled by the administrator

Do someone knows how to fix this problem in python?

like image 877
KarloKik Avatar asked Apr 19 '18 07:04

KarloKik


1 Answers

After a lot of work on this issue I finally came up with a solution. By looking at the responses on C# and Java I managed to apply same procedure to Selenium in python.

As described in this thread you need to somehow set the attribute of useAutomationExtension to False.

Here is what I did:

from selenium import webdriver

chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_experimental_option('useAutomationExtension', False)

driver = webdriver.Chrome(chrome_options=chromeOptions, desired_capabilities=chromeOptions.to_capabilities())
driver.get("http://www.python.org")

The code above simply creates ChromeOptions class and sets the attribute to false. The you run chrome driver with those options.

This solved my case. I hope it helps.

like image 96
Moustafa Memet Avatar answered Nov 09 '22 21:11

Moustafa Memet