I want to load my extension from directory.
Python version: 3.10.5
from playwright.sync_api import sync_playwright
from time import sleep
with sync_playwright() as playwright:
user_data_dir_path = "./Profiles"
extension_path = "./path_to_my_extension"
browser_context = playwright.chromium.launch_persistent_context(
user_data_dir_path,
headless=False,
executable_path="/usr/bin/chromium",
args=[
f"--disable-extensions-except={extension_path}",
f"--load-extension={extension_path}",
"--headless=new",
"--disable-gpu",
"--no-sandbox",
],
ignore_default_args=["--disable-extensions"]
)
page = browser_context.pages[0]
page.goto("chrome-extension://{extension_id}/{path}")
# page.goto("chrome://extensions")
sleep(5)
page.screenshot(path="screenshot.png")
will break with:
=========================== logs ===========================
navigating to "chrome-extension://{extension_id}/{path}", waiting until "load"
============================================================
I'm using Playwright instead of Selenium so I couldn't try the link below. Chrome Extensions in Selenium
Any help would be greatly appreciated. Thank you!