


Let’s make a very minimal Chrome extension and use it to verify that this code works. The above code will setup a Selenium driver for Chrome with the extension located at path/to/extension preinstalled. # Initalize the driver with the appropriate options.ĭriver = webdriver.Chrome(chrome_options=options) Options.add_argument('-load-extension=path/to/the/extension') # Configure the necessary command-line option. from selenium import webdriverįrom import NoSuchElementException This can be specified before launching Chrome with Selenium by creating a ChromeOptions instance and calling add_argument(). Running Google Chrome with an extension installed is quite simple because Chrome supports a -load-extension command-line argument for exactly this purpose.
