How to Start the VPN (Browsec) chrome extension with selenium python

Viewed 24

I want to Start browsec VPN extension with selenium but I don't know how to access it

this is my code to add the extension:

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

chrome_options = Options()
chrome_options.add_extension('C:/Users/DELL-PC/Downloads/Browsec.crx')
browser = webdriver.Chrome(executable_path='C:/Users/DELL-PC/Downloads/chromedriver.exe', options=chrome_options)
browser.get('https://www.google.co.in')

This code is just for adding the extension in the browser, for me i want also start the vpn extension.

1 Answers

I might be wrong but we can't click chrome extension icon with WebDriver, as icon is out of the Webpage.

Work around

But a worked around it by using the link: chrome-extension://<the extension identity>/html/login.html - instead of the icon. This way, I can test all the functions of the extension.

OR

for open the added Extension: I think we can set shortkey in chrome://extensions/ -> Keyboard shortcuts , add the Keyboard shortcuts to your added extension, then send Keyboard to launch the extension, see here

OR

You can sikuli to click on the extension for more detail here

Related