Selenium webdriver Browsermob代理在url更改时停止捕获?
我使用browsermob代理来捕获WebDriver(主要是chrome)的流量。 我的问题是:只要我使用单页,一切都正常,但是当URL更改时(由于导航到其他页面或重定向),代理不再捕获任何事件(我无法在HAR文件中看到这些事件) 以下是如何启动代理:Selenium webdriver Browsermob代理在url更改时停止捕获?,selenium-webdriver,proxy,webdriver,browsermob,browsermob-proxy,Selenium Webdriver,Proxy,Webdriver,Browsermob,Browsermob Proxy,我使用browsermob代理来捕获WebDriver(主要是chrome)的流量。 我的问题是:只要我使用单页,一切都正常,但是当URL更改时(由于导航到其他页面或重定向),代理不再捕获任何事件(我无法在HAR文件中看到这些事件) 以下是如何启动代理: BrowserMobProxyServer proxy = new BrowserMobProxyServer(); try { proxy.start(Integer.valueOf(proxyPool
BrowserMobProxyServer proxy = new BrowserMobProxyServer();
try {
proxy.start(Integer.valueOf(proxyPool.borrowProxyPort()), InetAddress.getLocalHost());
} catch (NumberFormatException | UnknownHostException e) {
Logger.error(e.getLocalizedMessage());
}
proxy.waitForQuiescence(30, 3, TimeUnit.SECONDS);
proxy.setHarCaptureTypes(CaptureType.REQUEST_HEADERS);
Logger.info("Proxy start status: " + proxy.isStarted());
下面是我如何得到har的:
proxy.waitForQuiescence(10, 10, TimeUnit.SECONDS);
return proxy.getHar();
我是否需要在URL更改或缺少smthn时以某种方式处理这些情况?这就是我的工作方式
BrowserMobProxyServer proxyBrowserMob = new BrowserMobProxyServer();
proxy.start();
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxyBrowserMob)
DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setCapability("marionette", true);
caps.setCapability(CapabilityType.PROXY, seleniumProxy);
RemoteWebDriver webDriver = new FirefoxDriver(caps);
proxyBrowserMob .enableHarCaptureTypes(CaptureType.REQUEST_CONTENT,CaptureType.REQUEST_HEADERS,CaptureType.REQUEST_COOKIES);
proxyBrowserMob .newHar();
为了检索HAR文件,我迭代HarEntry以获取HAR
List<HarEntry> entries = browserMobProxy.getHar().getLog().getEntries();
for (HarEntry entry : entries) {
// get HarRequest
/get HarResponse
}
List entries=browserMobProxy.getHar().getLog().getEntries();
for(HarEntry条目:条目){
//受到骚扰
/得到HarResponse
}
这就是我的工作方式
BrowserMobProxyServer proxyBrowserMob = new BrowserMobProxyServer();
proxy.start();
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxyBrowserMob)
DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setCapability("marionette", true);
caps.setCapability(CapabilityType.PROXY, seleniumProxy);
RemoteWebDriver webDriver = new FirefoxDriver(caps);
proxyBrowserMob .enableHarCaptureTypes(CaptureType.REQUEST_CONTENT,CaptureType.REQUEST_HEADERS,CaptureType.REQUEST_COOKIES);
proxyBrowserMob .newHar();
为了检索HAR文件,我迭代HarEntry以获取HAR
List<HarEntry> entries = browserMobProxy.getHar().getLog().getEntries();
for (HarEntry entry : entries) {
// get HarRequest
/get HarResponse
}
List entries=browserMobProxy.getHar().getLog().getEntries();
for(HarEntry条目:条目){
//受到骚扰
/得到HarResponse
}
您是否找到了解决方案?我有一个类似的问题,我需要捕获通过单击链接打开的新窗口发出的请求。不幸的是,您是否找到了解决方案?我有一个类似的问题,我需要捕获通过单击链接打开的新窗口发出的请求。不幸的是,没有