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
132 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,400 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
149 views
0 votes
1 answer

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

Check below: chromedriver = r"C:\Users\DMMaxim\Desktop\chromedri ...READ MORE

answered Jul 4, 2018 in Selenium by Samarpit
• 5,130 points
1,674 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
2,410 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
1,155 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
• 5,680 points
12 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,030 points
53 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
415 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,400 points
948 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,400 points
1,665 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.