0

I'm trying to use an authenticated proxy with seleniumbase (I'm using python) while running the browser in undetected Chrome (uc=True). However, despite trying multiple approaches, I'm unable to get the proxy authentication to work correctly. The prompt just keep comming up very time.

Here is my current setup:

chrome_options = { "headless": False, "uc": True, "incognito": True } chrome_options["proxy"] = f"{username}:{password}@{ip}:{port}" # Initialize the driver with authenticated proxy driver = Driver(**chrome_options) try: # Open the target website driver.get("https://ipinfo.io/json") print("Current IP info:", driver.page_source) sleep(10) finally: # Quit the driver driver.quit() 

✅ What I’ve Tried So Far:

  1. Passing the proxy with credentials directly in the "proxy" key as shown above — doesn’t seem to be picked up properly.
  2. I tried to use this package from python https://pypi.org/project/selenium-authenticated-proxy/ but it doesn't work either
  3. I'ved tried this method of creating a new extension running in the background
manifest_json = """ { "version": "1.0.0", "manifest_version": 2, "name": "Chrome Proxy", "permissions": [ "proxy", "tabs", "unlimitedStorage", "storage", "<all_urls>", "webRequest", "webRequestBlocking" ], "background": { "scripts": ["background.js"] }, "minimum_chrome_version":"22.0.0" } """ background_js = """ var config = { mode: "fixed_servers", rules: { singleProxy: { scheme: "http", host: "%s", port: parseInt(%s) }, bypassList: ["localhost"] } }; chrome.proxy.settings.set({value: config, scope: "regular"}, function() {}); function callbackFn(details) { return { authCredentials: { username: "%s", password: "%s" } }; } chrome.webRequest.onAuthRequired.addListener( callbackFn, {urls: ["<all_urls>"]}, ['blocking'] ); """ % (PROXY_HOST, PROXY_PORT, PROXY_USER, PROXY_PASS) def get_chromedriver(use_proxy=False, user_agent=None): path = os.path.dirname(os.path.abspath(__file__)) chrome_options = webdriver.ChromeOptions() if use_proxy: pluginfile = 'proxy_auth_plugin.zip' with zipfile.ZipFile(pluginfile, 'w') as zp: zp.writestr("manifest.json", manifest_json) zp.writestr("background.js", background_js) chrome_options.add_extension(pluginfile) if user_agent: chrome_options.add_argument('--user-agent=%s' % user_agent) driver = webdriver.Chrome( os.path.join(path, 'chromedriver'), chrome_options=chrome_options) return driver 

👉🏻 Doesn't work 🥲

4. I'ved search all the solution on github but nothing seem to work stably

I need some help 🥲

    0

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.