System.setProperty("webdriver.gecko.driver", "E:\\geckodriver-v0.18.0-win64\\geckodriver.exe");
Proxy p = new Proxy();
p.setSocksProxy("83.209.94.87:35923");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, p);
WebDriver driver = new FirefoxDriver(cap);
driver.get("https://www.google.com.au");
This code is inside the main method. When I run this code, firefox is launched but the google url isn't followed and the proxy is not set to the one I specify in the code above. How can I fix this?
public static void main(String[] args) throws InterruptedException, IOException, UnsupportedEncodingException {
while (true) {
System.setProperty("webdriver.gecko.driver", "E:\\geckodriver-v0.18.0-win64\\geckodriver.exe");
WebDriver driver;
String PROXY = "83.209.94.87:35923";
//Bellow given syntaxes will set browser proxy settings using DesiredCapabilities.
Proxy proxy = new Proxy();
proxy.setAutodetect(false);
proxy.setProxyType(Proxy.ProxyType.MANUAL);
proxy.setSocksProxy(PROXY);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
//Use Capabilities when launch browser driver Instance.
driver = new FirefoxDriver(cap);`
proxy.setProxyType(Proxy.ProxyType.MANUAL);andproxy.setAutodetect(false);afterProxy p = new Proxy();- Tarun Lalwani