I am able to set proxy settings for Firefox as below.
org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setProxyType(ProxyType.MANUAL);
proxy.setHttpProxy(CONFIG.getProperty("hostname"));
proxy.setSslProxy(CONFIG.getProperty("hostname"));
proxy.setFtpProxy(CONFIG.getProperty("hostname"));
proxy.setSocksUsername(CONFIG.getProperty("username"));
proxy.setSocksPassword(CONFIG.getProperty("password"));
FirefoxProfile fp = new FirefoxProfile();
fp.setProxyPreferences(proxy);
driver = new FirefoxDriver(fp);
builder = new Actions(driver);
bckdbrowser = new WebDriverBackedSelenium(driver, ConfigReader.ENVIRONMENT_URL);
But I need to setup for Chrome as well.. Can any one assist me how to do ?
Thanks Raj
You can try using the DesiredCapabilities
class, like this:
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches", Arrays.asList("--proxy-server=http://user:[email protected]:8080"));
WebDriver driver = new ChromeDriver(capabilities);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With