// start the proxy
BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start(0);
// get the Selenium proxy object
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
// configure it as a desired capability
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
// start the browser up
@SuppressWarnings("deprecation")
WebDriver driver = new ChromeDriver(capabilities);
// enable more detailed HAR capture, if desired (see CaptureType for the
// complete list)
proxy.enableHarCaptureTypes(CaptureType.REQUEST_BINARY_CONTENT, CaptureType.REQUEST_HEADERS,
CaptureType.REQUEST_CONTENT, CaptureType.REQUEST_COOKIES, CaptureType.RESPONSE_BINARY_CONTENT,
CaptureType.RESPONSE_CONTENT, CaptureType.RESPONSE_HEADERS, CaptureType.RESPONSE_COOKIES);
// create a new HAR with the label
proxy.newHar("google");
// open website
driver.get("https://www.google.co.in");
即使将ACCEPT_SSL_CERTS设置为True,它也无法正常工作,您能否建议如何以安全模式启动浏览器