After hours of research I am still not able to use a proxy with authentification (username, password) in selenium using chrome WebDriver.
Here is what I tried:
using a chrome extension -> not working in headless mode
using AutoIT -> technically it's working, but for my usecase not good enough
using chrome options arguments like below, doesn't work:
chromeOptions.addArguments("--proxy-server=http://" + username + ":" + password + "@" + proxyAndPort);
fill chrome authentification form with Selenium OOTB functionality: doesn't work because its an OS alert (thats why AutoIT can fill it)
Are there any other possibilities to connect with a proxy with authentification?
EDIT: After using browsermobproxy, I'm facing the issue that chrome shows me the error "ERR_EMPTY_RESPONSE". Here's my implementation:
BrowserMobProxyServer proxy = new BrowserMobProxyServer();
proxy.setChainedProxy(new InetSocketAddress(myIp, myPort));
proxy.chainedProxyAuthorization(username, password, AuthType.BASIC);
proxy.start(0);
chromeOptions.setProxy(ClientUtil.createSeleniumProxy(proxy));
WebDriver driver = new ChromeDriver(chromeOptions);
EDIT2: Use browsermob-proxy version 2.1.5 - everything works fine