How to load extension within chrome driver in selenium with python
Solution 1:
To open chrome browser with any extension you need to use the add_extension()
method through an instance of chrome.options
class and you can use the following solution :
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_extension(r'C:\path\to\extension.crx')
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
References
You can find the relevant documentation in:
- ChromeDriver - WebDriver for Chrome.
You can find a couple of relevant discussions in:
- [Python] How to install Chrome Extension using Selenium & Python
- [Java] How to install extension permanently in geckodriver