Запуск прокси
protected static void initProxy() {
try {
ServerSocket socket = new ServerSocket(0);
localProxyPort.set(socket.getLocalPort());
socket.close();
} catch (IOException e) {/**/}
ProxyServer server = new ProxyServer(localProxyPort.get());
try {
server.start();
server.setCaptureContent(true);
server.setCaptureHeaders(true);
server.newHar("test");
} catch (Exception e) {/**/}
proxyServer.set(server);
}
инициализация драйвера
DesiredCapabilities capabilities = null;
Proxy proxy = new Proxy();
String m_proxy = <host>+ ":" + <port>;
proxy.setHttpProxy(m_proxy).setFtpProxy(m_proxy);
capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.PROXY, proxy);
new ChromeDriver(capabilities);
я делала так, работает