1
  1. 开始 Selenoid

./cm selenoid start --vnc

  1. 启动 BMP 容器

docker run -p 58080:8080 -p 58200:8200 --name browser-mob-proxy bwowk/browsermob-proxy

  1. 启动代理

curl -X POST -d \'port=8081\' http://localhost:58080/proxy

  1. 创建 RemoteWebDriver
Proxy proxy = new Proxy();
proxy.setHttpProxy("localhost:8081");
String proxyOption = "--proxy-server=" + proxy.getHttpProxy();
options.addArguments(proxyOption);
options.setCapability("enableVNC", true);
options.setCapability("enableVideo", false);
String[] hosts = {"alf.arbetsformedlingen.se:164.135.40.54"};
options.setCapability("hostsEntries", hosts);
String[] containers = {"browser-mob-proxy"};
options.setCapability("applicationContainers", containers);
options.setExperimentalOption("useAutomationExtension", false);
driver = new RemoteWebDriver(new URL("http://164.135.124.71:4444/wd/hub"), options);

请帮助理解,我做错了什么或错过了什么!

4

0 回答 0