wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.9k stars 254 forks source link

Socks5 proxy is not working / being used #556

Closed Lance0210 closed 2 years ago

Lance0210 commented 2 years ago

When running the code I dont get any errors but the proxy is not being used instead my regular ip. I use a socks5 Proxy do I have to use an http/https ?

from seleniumwire.undetected_chromedriver as uc

proxy = '127.0.0.1:5000' uc_options = uc.ChromeOptions() uc_options.add_argument('--proxy-server=socks5://'+proxy)

driver = uc.Chrome( options = uc_options )

I also tried using the seleniumwire_options to add the proxy but didnt work either

wkeeling commented 2 years ago

For an upstream proxy you must use the configuration format:

options = {
    'proxy': {
        'http': 'socks5://127.0.0.1:5000',
        'https': 'socks5://127.0.0.1:5000',
    }
}
driver = webdriver.Chrome(seleniumwire_options=options)

Have you tried manually configuring the SOCKS proxy in Chrome's settings? Worth trying that first and then browsing to a site manually (no Selenium Wire) just to prove SOCKS is changing the IP without Selenium Wire.

Lance0210 commented 2 years ago

I used the wrong format, thanks for solving my issue