ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.76k stars 1.15k forks source link

how can i use http proxy with auth? #579

Closed eidelee closed 2 years ago

eidelee commented 2 years ago

how can i use http proxy with auth? here is my code

import undetected_chromedriver as uc

options = uc.ChromeOptions()
seleniumwire_options = {
            'proxy':
                {'http': f'http://{acc}:{pw}@{proxy}:{port}',
                 'https': f'http://{acc}:{pw}@{proxy}:{port}',
                 'no_proxy': 'localhost,127.0.0.1'}
        }
driver = uc.Chrome(options=options, version_main=99, seleniumwire_options=seleniumwire_options)
driver.get('https://api.ipify.org?format=json')

but it also show my real IP address

sebdelsol commented 2 years ago

If you need to use seleniumwire with undetected-chromedriver you'll want to import it as suggested in the seleniumwire documentation :

import seleniumwire.undetected_chromedriver as uc

Surprisingly you'd expected your code to throw a TypeError for the unexpected seleniumwire_options argument but the Chrome.__init__() method silently captures all **kwargs without forwarding them to its Selenium parent class constructor... and that's funnily done so because seleniumwire actually needs it for its own initialization...

I guess that made your issue quite confusing : it seemed to work but actually silently ditched your selenium_wire_options argument ! Now you know why you should read the docs.

eidelee commented 2 years ago

thanks for your help! its working!

i will read again the documentation