python selenium add extension code example
Example 1: chromedriver selenium python
sudo apt-get install chromium-chromedriver
1. Download the lastest version of driver from:
https://sites.google.com/a/chromium.org/chromedriver/
2. Unzip the file.
3. Paste the file in /usr/local/bin using this command:
sudo mv chromedriver /usr/local/bin
4. Make your file executable:
sudo chmod +x /usr/local/bin/chromedriver
Now you can use this in python:
>>from selenium import webdriver
>>browser = webdriver.Chrome()
Example 2: selenium addd chrome extension
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = webdriver.ChromeOptions()
options.add_extension('./exampleOfExtensionDownloadedToFolder.crx')
driver = webdriver.Chrome(chrome_options=options)
driver.get('http://www.google.com')