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);`
当我运行此代码并启动firefox时,代理设置将设置为“使用系统代理设置'”。如何启动firefox,它的代理设置会自动更改为我指定的代理。