Reputation: 79
When I navigate to my url on chrome, I get The system cannot find the file specified." . I thought it might be due to automatic proxy settings on chrome. I want to explicitly turn off the proxy setting before starting chrome browser in selenium. I tried below, it isn't working. Can anyone help me
ChromeOptions options = new ChromeOptions();
DesiredCapabilities dc = DesiredCapabilities.chrome();
dc.setCapability("chrome.setProxyByServer", false);
System.setProperty("webdriver.chrome.driver",sChromeDriverPath);
WebDriver driver = new ChromeDriver();
No errors are thrown at any point of time but URL doesn't open up
Tia Anjana
Upvotes: 2
Views: 11208
Reputation: 6962
You need to pass the options object to the chrome driver when you initialize it. If you use a specific capability then pass it to the chromeDriver()
, so that chrome knows what to start with. Also there is no JSON object as setProxyByServer in chrome, instead use noProxy
JSON object. Check this out. Here's how -
Proxy proxy=startProxy();
proxy.setProxyType(ProxyType.MANUAL);
proxy.setNoProxy("");
ChromeOptions options = new ChromeOptions();
DesiredCapabilities dc = DesiredCapabilities.chrome();
dc.setCapability(CapabilityType.PROXY, proxy);
System.setProperty("webdriver.chrome.driver",sChromeDriverPath);
dc.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(dc);
More info about chrome capabilities. Hope it helps.
Upvotes: 3