R
R
r1dddy4sv2021-04-21 15:01:48
Python
r1dddy4sv, 2021-04-21 15:01:48

Proxy with selenium firefox authorization?

I'm trying to access a site using a proxy with authorization, but the proxy is simply not being used

path = os.path.dirname(os.path.abspath(__file__))
                host=proxy.split(':')[0]
                port=int(proxy.split(':')[1])
                username=proxy.split(':')[2]
                password=proxy.split(':')[3]
                myProxy = f"{username}:{password}@{host}:{port}"
                proxym = Proxy({
                    'proxyType': ProxyType.MANUAL,
                    'httpProxy': myProxy,
                    'ftpProxy': myProxy,
                    'sslProxy': myProxy,
                    'noProxy': '' # set this value as desired
                    })
                driver = webdriver.Firefox(executable_path=os.path.join(path, 'geckodriver.exe'),firefox_binary=os.path.join(path, 'Mozilla Firefox\\firefox.exe'), proxy=proxym)

also I tried another way:
from seleniumwire import webdriver
options = {
'proxy': {
    'http': 'http://username:[email protected]:port',
    'https': 'https://username:[email protected]:port',
    'no_proxy': 'localhost,127.0.0.1,dev_server:8080'
    }
}
driver = webdriver.Firefox(seleniumwire_options=options)

but in this case the connection to the site was not secure, which should not be

+ I'm looking for a way that can be used for headless mode

I would appreciate any help

Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2021-04-21
@dimonchik2013

so what is it that doesn't work?
https://www.browserstack.com/guide/set-proxy-in-se...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question