Java Browsermob不';不要通过酱汁连接拦截酱汁实验室的任何东西
我正在尝试从Browserstack切换到Sauce Labs(前者在docker中生成一个僵尸进程,挂起整个容器)。虽然所有东西似乎都在连接和侦听端口,但HAR是空的 我的设置很简单:在运行测试的机器上,我从代码中启动BMP和SC。然后,我的测试启动一个远程WebDriver,它打开一个网页(我在这里使用Google作为一个例子)。然后,这个互联网连接应该通过BMP代理,这样我就可以捕获所有的分析 根据我使用BrowserStack的经验,这是有效的。然而,在酱汁实验室的相同设置中,我没有截获任何东西Java Browsermob不';不要通过酱汁连接拦截酱汁实验室的任何东西,java,selenium-webdriver,saucelabs,browsermob-proxy,browsermob,Java,Selenium Webdriver,Saucelabs,Browsermob Proxy,Browsermob,我正在尝试从Browserstack切换到Sauce Labs(前者在docker中生成一个僵尸进程,挂起整个容器)。虽然所有东西似乎都在连接和侦听端口,但HAR是空的 我的设置很简单:在运行测试的机器上,我从代码中启动BMP和SC。然后,我的测试启动一个远程WebDriver,它打开一个网页(我在这里使用Google作为一个例子)。然后,这个互联网连接应该通过BMP代理,这样我就可以捕获所有的分析 根据我使用BrowserStack的经验,这是有效的。然而,在酱汁实验室的相同设置中,我没有截获
@BeforeClass
public void SetUp() {
SauceConnectFourManager = new SauceConnectFourManager(true);
browserMobProxyServer = new BrowserMobProxyServer();
browserMobProxyServer.setTrustAllServers(true);
browserMobProxyServer.start(9191);
browserMobProxyServer.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);
try {
SauceConnectFourManager.openConnection(username, key,4445,
null, "-v --pac file://" + filePath,
null, false, null);
} catch (IOException e) {
e.printStackTrace();
}
DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability("platform", "Windows 10");
caps.setCapability("version", "latest");
String url = "https://" + username + ":" + key + "@ondemand.saucelabs.com:443/wd/hub";
try {
driver = new RemoteWebDriver(new URL(url), caps);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
@Test
public void TestShouldPass() {
/**
* Goes to Google's page just as an example
*/
driver.get("https://google.com");
System.out.println("title of page is: " + driver.getTitle());
}
@AfterClass
public void TearDown() {
driver.quit();
SauceConnectFourManager.closeTunnelsForPlan(username, null, null);
//har is null here!
Har har = browserMobProxyServer.getHar();
FileOutputStream fos;
try {
fos = new FileOutputStream("debug.har");
har.writeTo(fos);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
browserMobProxyServer.stop();
}