Using Extensions with Selenium - Python

0 votes
I am currently using Selenium to run instances of Chrome to test web pages. Each time my script runs, a clean instance of Chrome starts up (clean of extensions, bookmarks, browsing history, etc). I was wondering if it's possible to run my script with Chrome extensions. I've tried searching for a Python example, but nothing came up when I googled this.
Aug 23, 2018 in Selenium by ghost
• 1,790 points
426 views

1 answer to this question.

0 votes

You should use chrome web driver options to set a list of extensions to load. 

Below is the code:

import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

executable_path = "path_to_webdriver"
os.environ["webdriver.chrome.driver"] = executable_path

chrome_options = Options()
chrome_options.add_extension('path_to_extension')

driver = webdriver.Chrome(executable_path=executable_path, chrome_options=chrome_options)
driver.get("http://stackoverflow.com")
driver.quit()
answered Aug 23, 2018 by Meci Matt
• 9,420 points

Related Questions In Selenium

0 votes
1 answer

How to login a forum using Selenium with Python

You should try to directly log in ...READ MORE

answered Apr 27, 2018 in Selenium by Samarpit
• 5,130 points
346 views
0 votes
2 answers

Python: Using an existing google chrome profile with selenium chrome web driver

The problem is with the string "C:\Users\Eric\Desktop\beeline.txt" Here, \U starts an ...READ MORE

answered May 23 in Selenium by shinio llahsra
3,169 views
0 votes
1 answer

Selecting xpath for with multiple conditions using Selenium and Python

Use the XPath in either of the following ways ...READ MORE

answered Jul 12, 2018 in Selenium by Samarpit
• 5,130 points
6,047 views
0 votes
1 answer

How to click a span with given text using Selenium Python

If ALL_USA is subject to change, then ...READ MORE

answered Jul 26, 2018 in Selenium by Samarpit
• 5,130 points
2,068 views
0 votes
1 answer

Installing Selenium Webdriver with Python package

Hey Hemant, for installing Selenium Webdriver with ...READ MORE

answered May 8 in Selenium by Anvi
• 13,960 points
232 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,110 points
976 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
1,131 views
0 votes
1 answer

Get coordinates or dimensions of element with Python using Selenium WebDriver

WebElements have the properties such as .size and .location. ...READ MORE

answered Jul 11, 2018 in Selenium by Meci Matt
• 9,420 points
2,212 views
0 votes
1 answer

Is it possible for a website to detect that we are using Selenium with ChromeDriver

Selenium tests for pre-defined javascript variables which ...READ MORE

answered Apr 27, 2018 in Selenium by Meci Matt
• 9,420 points
2,368 views