Hello stackoverflow community,
I would like to ask you a question on how to change dynamically proxy during a running script on webdriver.
Proxy proxy = new Proxy();
proxy.setSslProxy("server:port");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("proxy", proxy);
ChromeOptions options = new ChromeOptions();
options.addArguments("start-minimized");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(capabilities);
driver.get("https://myip.com/);
The above code successfully browses to myip.com showing the proxy I connected to. Anyway I would like to connect to another proxy and refresh the page so that myip.com would show the second IP.
Therefore essentially using multiple proxies during an execution.
I'm looking for this answer from weeks and all I could find are these two threads that didn't help me because they are written in python : How to change proxy on my webdriver multiple times on a single session?
Python Selenium Webdriver - Changing proxy settings on the fly
This is my first stackoverflow thread request, hope that everything's understandable! Thank you!