Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting proxy in Incognito mode has no effect #294

Open
wang0916 opened this issue Dec 10, 2024 · 1 comment
Open

Setting proxy in Incognito mode has no effect #294

wang0916 opened this issue Dec 10, 2024 · 1 comment
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@wang0916
Copy link

wang0916 commented Dec 10, 2024

I tried to use a proxy in Incognito mode, but it didn't work

from selenium_driverless import webdriver
import asyncio


async def main():
    proxy = "http://127.0.0.1:10809"
    options = webdriver.ChromeOptions()
    options.add_argument('--incognito')
    async with webdriver.Chrome(options=options) as driver:
        # this will overwrite the proxy for ALL CONTEXTS
        await driver.set_single_proxy(proxy)
        await driver.get("https://ip.900cha.com/")
        await asyncio.sleep(1000)

asyncio.run(main())
@kaliiiiiiiiii
Copy link
Owner

I tried to use a proxy in Incognito mode, but it didn't work ` from selenium_driverless import webdriver import asyncio

async def main(): proxy = "http://127.0.0.1:10809" options = webdriver.ChromeOptions() options.add_argument('--incognito') async with webdriver.Chrome(options=options) as driver: # this will overwrite the proxy for ALL CONTEXTS await driver.set_single_proxy(proxy) await driver.get("https://ip.900cha.com/") await asyncio.sleep(1000)

asyncio.run(main())

Yes, because for setting proxies dynamically, a chrome-extension is required
Adding those chrome extensions is only really possible without incognito

Workaround: Startup without incognito, use https://kaliiiiiiiiii.github.io/Selenium-Driverless/api/Chrome.html#selenium_driverless.webdriver.Chrome.new_context
Should be aequivalent

@kaliiiiiiiiii kaliiiiiiiiii added bug Something isn't working wontfix This will not be worked on labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants