尝试使用playwright测试Chrome Extensions时,无法加载扩展名和清单文件不读取

发布于 2025-02-08 17:23:40 字数 925 浏览 3 评论 0原文

我正在尝试使用剧作家为铬添加铬延长。使用 playwright docs 出于相当小的修正案而言。

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()

我收到:

无法从:/users/name/projects/test_me/src/my_extensions/mm.m.crx加载扩展。清单文件缺少或不可读

我确定扩展名与扩展名称本身的路径本身正确,这是几次。另外,我尝试了不同的选项来提供路径:如示例中的硬编码;使用OS模块;但是,改变路径仍然存在。

此外,我尝试使用不同的解决方案下载.crx文件,这也无济于事。

非常感谢任何建议:)

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 :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文