I had to run the Webdriver scripts on a Firefox and I had to use a particular proxy to get access to the
QA/Dev environment. Here is the code that you can use to change the proxy settings.
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("network.proxy.type", 1);
firefoxProfile.setPreference("network.proxy.http", "100.00.100.100");
firefoxProfile.setPreference("network.proxy.http_port", 80);
firefoxProfile.setPreference("network.proxy.ssl", "100.00.100.100");
firefoxProfile.setPreference("network.proxy.ssl_port", 80);
firefoxProfile.setPreference("network.proxy.no_proxies_on", "");
driver = new FirefoxDriver(firefoxProfile);
Make changes to the PROXY_HOST – “100.00.100.100″ and the PROXY_PORT – 80. The PROXY_PORT is an Integer and PROXY_HOST is a String.
On IE (applicable for firefox also):
QA/Dev environment. Here is the code that you can use to change the proxy settings.
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("network.proxy.type", 1);
firefoxProfile.setPreference("network.proxy.http", "100.00.100.100");
firefoxProfile.setPreference("network.proxy.http_port", 80);
firefoxProfile.setPreference("network.proxy.ssl", "100.00.100.100");
firefoxProfile.setPreference("network.proxy.ssl_port", 80);
firefoxProfile.setPreference("network.proxy.no_proxies_on", "");
driver = new FirefoxDriver(firefoxProfile);
Make changes to the PROXY_HOST – “100.00.100.100″ and the PROXY_PORT – 80. The PROXY_PORT is an Integer and PROXY_HOST is a String.
On IE (applicable for firefox also):
String PROXY = "localhost:8080";
org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(PROXY)
.setFtpProxy(PROXY)
.setSslProxy(PROXY);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new InternetExplorerDriver(cap);
Comments
Post a Comment