I use selenium for some browser automation. I need to install the extension in the browser for my work. I do it as follows:
import selenium from selenium import webdriver from selenium.webdriver.chrome.options import Options executable_path = "/usr/bin/chromedriver" options = Options() options.add_extension('/home/TheRookie/Downloads/extensionSamples/abhcfceiempjmchhhdhbnkbimnfpckgl.crx') browser = webdriver.Chrome(executable_path=executable_path, chrome_options=options)
The browser starts up fine, but I am prompted with a popup to confirm that I want to add the extension as follows:

and after I get this popup, Python will be back soon with the following exception:
selenium.common.exceptions.WebDriverException: Message: u'unknown Error: Could not wait for additional page to load: chrome extension: //abhcfceiempjmchhhdhbnkbimnfpckgl/toolbar.html \ Nfrom unknown error: page not found: chrome extension: // abhcfcehbbbmbmbmbmbm html \ n (Driver Information: chromedriver = 2.12.301324 (De8ab311bc9374d0ade71f7c167bad61848c7c48), platform = Linux 3.13.0-39-generic x86_64) '
I tried to treat the popup as a normal JavaScript alert using the following code:
alert = browser.switch_to_alert() alert.accept()
However, this does not help. Can someone tell me how can I install this extension without a popup or a way to accept a popup? Any help would be greatly appreciated. Thanks!
source share