question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remote Webdriver seems not connect to Proxy with authentication

See original GitHub issue

I 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:open
  • Created 2 years ago
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
wkeelingcommented, Oct 27, 2021

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.

0reactions
Akash-nykaacommented, May 27, 2022

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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to set proxy with authentication in selenium chromedriver ...
This code configures selenium with chromedriver to use HTTP proxy that requires authentication with user/password pair. Save this answer. Show ...
Read more >
How to Handle Proxy Authentication in Selenium Webdriver
Selenium Proxy Authentication : Proxy Authentication using Selenium Webdriver is a great tool to help you access any website or page using ...
Read more >
Configure Proxy Settings for Selenium Tests - BrowserStack
Set up a Local Testing connection for Selenium tests behind proxies on BrowserStack Automate. Test websites on 3000+ real browsers and devices.
Read more >
Add support for proxy authentication (username / password)
So if you can replicate it via the following steps I would suggest we reopen the bug. 1. Create a new Firefox profile...
Read more >
Setting a proxy via DesiredCapabilities in RemoteWebDriver
RemoteWebDriver, I'm actually using it with a selenium server sitting ... but I dont seem to be hitting the proxy server either (Not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found