0

I have the following code:

public class LoadBrowserAndSurf {
    @Test
    public void loadAndSurf() {
        System.setProperty("webdriver.chrome.driver", "D:\\Desktop\\Automation Requirements\\chromedriver\\chromedriver.exe");
        String proxyString= "13.228.117.219";
        Proxy proxy = new Proxy();
        proxy.setHttpProxy(proxyString);
        DesiredCapabilities browserProxy =new DesiredCapabilities();
        browserProxy.setCapability(CapabilityType.PROXY,proxy);
        WebDriver wd = new ChromeDriver(browserProxy);
        wd.get("http://www.globe.com.ph/");
    }
}

In eclipse oxygen this code is able to initiate the driver version, however it is not accessing the proxy.

When try I the same code in the IntelliJ editor, it strikes out the ChromeDriver in the driver object initiation line i.e:

WebDriver wd = new ChromeDriver(browserProxy);

And states message as:

ChromeDriver(org.openqa.selenium.Capabilities) is depricated

Is there a way I can add this proxy in the driver instance when it launches in runtime?

frianH
  • 5,901
  • 6
  • 13
  • 36
  • The old method of just building with Capabilities is deprecated. Now, it takes a ChromeDriverService & Capabilities as parameters: https://stackoverflow.com/questions/46786043/chromedrivercapabilities-capabilities-is-deprecated – y.bedrov Jul 24 '18 at 12:21
  • Great thanks! I tried the following and it worked well. ChromeOptions options = new ChromeOptions(); options.setCapability("capability_name", "capability_value"); driver = new ChromeDriver(options); – Tushar Jadhav Aug 02 '18 at 12:51

0 Answers0