How to set Proxy setting for Chrome in Selenium Java -


i able set proxy settings firefox 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 need setup chrome well.. can 1 assist me how ?

thanks raj

you can try using desiredcapabilities class, this:

desiredcapabilities capabilities = desiredcapabilities.chrome(); capabilities.setcapability("chrome.switches", arrays.aslist("--proxy-server=http://user:password@proxy.com:8080")); webdriver driver = new chromedriver(capabilities); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -