Remote Webdriver seems not connect to Proxy with authentication
See original GitHub issueI followed the instruction from the main page of selenium-wire, both webdriver.Chrome
and webdriver.Firefox
works fine with proxy declaration on seleniumwire_options
at my local machine with:
opt = {
'proxy': {
'http': 'http://<user>:<password>@exampleproxy:3128',
'https': 'https://<user>:<password>@exampleproxy:3128'
}
}
but when i was trying with webdriver.Remote
with full options set up like this
option = webdriver.ChromeOptions()
option.add_argument("enable-automation")
option.add_argument("--headless")
option.add_argument("--window-size=1366,768")
option.add_argument("--no-sandbox")
option.add_argument("--disable-extensions")
option.add_argument("--dns-prefetch-disable")
option.add_argument("--ignore-certificate-errors")
option.add_argument("--disable-gpu")
opt = {
'auto_config': False,
'addr': '0.0.0.0',
'proxy': {
'http': 'http://<user>:<password>@exampleproxy:3128',
'https': 'https://<user>:<password>@exampleproxy:3128'
}
}
option.add_argument("--proxy-server={}".format('exampleproxy:3128'))
#####THIS USING CHROMEDRIVER AT LOCAL MACHINE ########
#driver = webdriver.Chrome('/home/tranvinhliem/selenium-grid/chromedriver_linux64/chromedriver', desired_capabilities=option.to_capabilities(), seleniumwire_options=opt)
#####THIS USING REMOTE CHROME AT REMOTE SERVER ##########
driver = webdriver.Remote(command_executor='https://remoteseleniumhub/wd/hub', desired_capabilities=option.to_capabilities(), seleniumwire_options=opt)
auto_config
when i set to True it occurred the error like this but just for the remote selenium hub
selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_PROXY_CONNECTION_FAILED
and it seems not passing connection to proxy anymore when auto_config
was set False then webdriver establish directly a connection point to website (not through out proxy), the reason i know that because the IP i checked on this connection from node chrome of selenium hub itself not IP from proxy’s server, it occurred for both Remote, Chrome or Firefox. Would i miss somethings ?
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (2 by maintainers)
Yes that should be the ip/domain of your local machine running Selenium Wire. The browser running in Selenium Hub will then send traffic back to Selenium Wire for capture.
Remote
Selenium Wire has limited support for using the remote webdriver client. When you create an instance of the remote webdriver, you need to specify the hostname or IP address of the machine (or container) running Selenium Wire. This allows the remote instance to communicate back to Selenium Wire with its requests and responses.
options = { ‘addr’: ‘hostname_or_ip’. # Machine ip on which docker is hosted } driver = webdriver.Remote( command_executor=‘http://www.example.com’, seleniumwire_options=options )
This is working fine for me. No proxy required.
EX:- desired_cap = {‘browserName’: ‘chrome’} swoptions = { ‘addr’: ‘172.x.x.x’ } driver = swdriver.Remote(command_executor=‘http://172.x.x.x:4444/wd/hub’, desired_capabilities=desired_cap, seleniumwire_options=swoptions)