[Python] Unable to Load Extensions in nodriver Proxy Context

Discussão em 'Python' iniciado por Stack, Setembro 10, 2025.

  1. Stack

    Stack Membro Participativo

    I need to load user profile, extensions and proxy in a single page context. Looks like it is not possible to do so right now using nodriver, any help/suggestion would be appreciated. Thanks

    Right now the user profile gets loaded just fine, but no extension gets loaded within the proxy context.

    # import nodriver as nd
    from nodriver import *
    import asyncio
    import subprocess

    path_to_extension_1 = r'D:\chrome_profile\User Data\Default\Extensions\hoklmmgfnpapgjgcpechhaamimifchmp\6.12.9_0'
    path_to_extension_2 = r'D:\chrome_profile\User Data\Default\Extensions\hlkenndednhfkekhgcdicdfddnkalmdm\1.13.0_0'

    async def main():

    config = Config(
    headless=False,
    user_data_dir=r"D:\chrome_profile\User Data",
    lang="en-US",
    browser_args=[
    "--disable-extensions-except=D:/chrome_profile/User Data/Default/Extensions/hoklmmgfnpapgjgcpechhaamimifchmp/6.12.9_0,D:/chrome_profile/User Data/Default/Extensions/hlkenndednhfkekhgcdicdfddnkalmdm/1.13.0_0",
    "--load-extension=D:/chrome_profile/User Data/Default/Extensions/hoklmmgfnpapgjgcpechhaamimifchmp/6.12.9_0,D:/chrome_profile/User Data/Default/Extensions/hlkenndednhfkekhgcdicdfddnkalmdm/1.13.0_0"
    ]
    )

    browser = await Browser.create(config)

    tab = await browser.create_context(
    url = "https://jsonip.com/",
    proxy_server = "socks5://xyz:xyz@123:123",
    # new_tab=True,
    # new_window=False
    )

    await tab.get('https://jsonip.com/')

    await asyncio.sleep(10)
    browser.stop()

    if __name__ == '__main__':
    # since asyncio.run never worked (for me)
    loop().run_until_complete(main())

    Continue reading...

Compartilhe esta Página