Showing posts with label browser. Show all posts
Showing posts with label browser. Show all posts

Friday, August 31, 2012

How do we configure proxy to our browser?

If we need to use a proxy. How do we configure that?

Proxy configuration is done via the org.openqa.selenium.Proxy class like so:

Proxy settings need to set, when an application runs under proxy. And also we can set
the Desired Capabilities for any given browser. 

Proxy proxy = new Proxy();
proxy.setProxyAutoconfigUrl("http://youdomain/config");
// We use firefox as an example here.
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(CapabilityType.PROXY, proxy);
// You could use any webdriver implementation here
WebDriver driver = new FirefoxDriver(capabilities);