0

I am trying to add a Chrome extension to Chromium using Playwright. Use Playwright docs for that purpose with pretty small amendments.

path_to_extension = "/Users/name/projects/test_me/src/my_extensions/mm.crx"
user_data_dir = "/tmp/test-user-data-dir"

def run(playwright):
    context = playwright.chromium.launch_persistent_context(
        user_data_dir,
        headless=False,
        args=[
            f"--disable-extensions-except={path_to_extension}",
            f"--load-extension={path_to_extension}",
        ],
    )
    background_page = context.background_pages[0]
    context.close()

I receive:

Failed to load extension from: /Users/name/projects/test_me/src/my_extensions/mm.crx. Manifest file is missing or unreadable

I am sure that the path to the extension along with extension name itself are correct, checked these few times. Also, I tried different options to provide the path: hardcoded as in the example; using os module; changing path, however, still there.

Additionally, I tried to download .crx file using different solutions, that didn't help as well.

Would highly appreciate any suggestions :)

Moveton
  • 37
  • 7
  • 3
    load-extension expects an unpacked directory, not crx, AFAIK. Use unzip to unpack your crx. – wOxxOm Jun 20 '22 at 10:08
  • 1
    And now that works, thx @wOxxOm! You should make an answer, so I could pick it as a solution :) – Moveton Jun 20 '22 at 11:31

0 Answers0