0

I am working with Selenium in Python and there is a Chrome extension I installed in my browser in which I would like to use in my automated script. While running my script I can't find the extension anywhere, is this purposely implemented by Google or is there a way to do so?

Chris
  • 58
  • 1
  • 8

1 Answers1

0

Selenium creates a temporary profile in the browser everytime you run it, and by default it does not have any extensions loaded.

To use extensions, you need to create a separate profile in chrome, add the necessary extensions to it, and then pass the profile to your webdriver.

It has been answered here: How to use Chrome Profile in Selenium Webdriver Python 3


Here is the answer taken from above:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("user-data-dir=C:\\Users\\User_name\\AppData\\Local\\Google\\Chrome\\User Data\\Profile you just created")
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', chrome_options=options)
driver.get("https://www.google.com")

You can use your default profile in selenium by putting "Default" in place of "Profile you just created", although creating a separate profile is good practice.

Jazib Dawre
  • 64
  • 3
  • 4