Attempting to incorporate an extension while using SeleniumBase.
add a comment
To incorporate an extension while using SeleniumBase, you can use the following steps:
Here is an example code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from seleniumbase import BaseCase
class ExtensionTest(BaseCase):
def test_extension(self):
# Add the extension file to your project folder
extension_path = 'your_extension.crx'
# Define ChromeOptions object and add extension path to it
options = Options()
options.add_extension(extension_path)
# Initialise the driver with the ChromeOptions object
self.driver = webdriver.Chrome(options=options)
# Launch the browser and navigate to the desired page
self.driver.get('https://www.google.com')
Make sure to replace 'your_extension.crx' with the actual extension file name and path.
Asked: 2022-08-30 11:00:00 +0000
Seen: 13 times
Last updated: Apr 11 '22