直接上代码:

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("user-data-dir=D:/temp/");
options.addArguments("--proxy-server=127.0.0.1:8080");
options.addArguments("--ignore-ssl-errors=yes");
options.addArguments("--ignore-certificate-errors");


capabilities.setCapability("chrome.binary","res/chromedriver.exe");
capabilities.setCapability(ChromeOptions.CAPABILITY,options);
driver = new ChromeDriver(capabilities);
05-21 05:04