How to enable proxy username and password for proxy server?

I don’t want to specify the username / password for the proxy server that I have for my office network, I could provide PROXY for the browser:

String PROXY = "localhost:8080"; org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy(); proxy.setHttpProxy(PROXY) .setFtpProxy(PROXY) .setSslProxy(PROXY); DesiredCapabilities cap = new DesiredCapabailities(); cap.setPreference(CapabilityType.PROXY, proxy); 

or

 user_pref("network.proxy.http", "127.0.0.1"); user_pref("network.proxy.http_port", 8084); user_pref("network.proxy.ssl", "127.0.0.1"); user_pref("network.proxy.ssl_port", 8084); user_pref("network.proxy.no_proxies_on", "localhost:4444"); user_pref("network.proxy.type", 1); 

but what I do, it still asks for a password for Webdriver. Note. I can send username / password for htmlunit driver. PLEASE, HELP!

+6
source share
2 answers

Try below

  FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("network.proxy.type", 0); WebDriver driver = new FirefoxDriver(profile); 
0
source

I read a lot of posts saying you need to send a base64 encoded profile.

 cap.setPreference(CapabilityType.PROXY, proxy.ToBase64String()); 

The documentation I read has never been convincing if it is necessary or not, but it is worth it.

0
source

Source: https://habr.com/ru/post/905850/


All Articles