I am trying to run my selenium java code to test a webpage. But webpage is not loading because of network restrictions. When I set the proxy manually and hit the url in browser
Passing a Capabilities object to the ChromeDriver() constructor is deprecated
. You can find new official doc here.
ChromeOptions chromeOptions = new ChromeOptions();
Proxy proxy = new Proxy();
proxy.setAutodetect(false);
proxy.setHttpProxy("http_proxy-url:port");
proxy.setSslProxy("https_proxy-url:port");
proxy.setNoProxy("no_proxy-var");
chromeOptions.setCapability("proxy", proxy);
driver = new ChromeDriver(chromeOptions);