If yes, how is it called, or where can I find more info about it? (I'm not talking about using WebDriverBackend.)
If not, what alternatives are there?
If yes, how is it called, or where can I find more info about it? (I'm not talking about using WebDriverBackend.)
If not, what alternatives are there?
You can capture network traffic using a proxy, such as the BrowserMob Proxy (http://proxy.browsermob.com)
To configure the use of the proxy with a webdriver instance, set the CapabilityName.PROXY value to a org.openqa.selenium.Proxy instance:
Proxy proxy = new Proxy();
// The URL here is the URL that the browsermob proxy is using
proxy.setHttpProxy("localhost:9100");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new FirefoxDriver(capabilities);
Once the test is finished, you can extract the data from the browsermob proxy using the mechanisms it provides. Notice that you can also use any proxy you want: it need not be the browsermob one!
No there is no native solution at the moment. If you use webDriverBackedSelenium you can try to utilise the captureNetworkTraffic functionality, however there were issues with it last time I heard it talked about (See here for more info - https://groups.google.com/d/topic/selenium-users/fMSHeH9ZVqU/discussion).
It's also worth noting that captureNetworkTraffic only works in FireFox due to the way it was implemented so it's not a cross browser solution.
*Update*
Based on some information that came through the selenium/webdriver mailing lists you can use a proxy instead (Suggested one is http://bmp.lightbody.net/, although there are others).
To configure it:
Proxy proxy = new Proxy();
proxy.setHttpProxy(<proxyAddress>);
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new FirefoxDriver(cap);
This should currently work for FireFox and IE. It looks like this is going to be the way to capture network traffic moving forward.
Note: "new Proxy()" - Needs org.openqa.selenium.Proxy.
I've been using a combination of Charles Proxy and window.performance.getEntriesByType('resource')
inside an executeScript
. Performance does not capture POST data, so that is why I also use Charles. I export the Charles session as a .har file and then use a nodejs script to merge the data.
Collect window performance data, filtered to get Adobe Analytics ("b/ss"), and then just returning the name aka the GET or POST url string .
let getPerformance = () => {
return (window.performance.getEntriesByType('resource').filter(function(entry){
return /b\/ss/i.test(entry.name);
})).map( entry => { return decodeURIComponent(entry.name) }).join("\n");
}
driver.executeScript( getPerformance ).then( windowPerformance => { /* do something with window.performance data */ })
Haven't looked through it all yet, but I did find a post that seems related. Also, haven't tried it out, but, have you looked at any of the fiddler libraries? Although I have plans on trying them out, it's not going to be for a few months yet.
Yes you can automate it using BrowserMob Proxy. [Please use the below mentioedn link to test Network traffic using BrowserMob Proxy
https://keshavtechinfo.wordpress.com/web-automation/selenium/web-page-load-testing-using-selenium-and-browsermob-proxy/ ]1