BrowserMob does not capture post Payload data( getPostData() returns null )
See original GitHub issueBrowsermob version (2.1.4) Embedded Mode
I have set the proxyServer.setHarCaptureTypes(CaptureType.REQUEST_HEADERS, CaptureType.REQUEST_CONTENT) ;
Still the getPostData on harRequest returns null.
My Sample code is pretty much same as example in docs but for my project URL. ` BrowserMobProxy proxy = new BrowserMobProxyServer(); proxy.start(0);
// get the Selenium proxy object
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
// configure it as a desired capability
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
// start the browser up
WebDriver driver = new FirefoxDriver(capabilities);
// enable more detailed HAR capture, if desired (see CaptureType for the complete list)
proxy.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);
// create a new HAR with the label "yahoo.com"
proxy.newHar("MyProject");
// open yahoo.com
driver.get("My URL");
// get the HAR data
List <HarEntry> entries = proxy.getHar().getEntries().stream().filter(entry -> entry.getRequest().getMethod().equals(“POST”)).filter(entry -> entry.getRequest().getPostData().getText().contains(“abc”)).collect(Collectors.toList());`
.getPostData().getText() throws nullPointer exception.
Any Suggestions?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
HarRequest.Postdata() returning NULL - JAVA + SELENIUM+ ...
For HTTP traffic , i am using browsermob proxy I am getting the ... getPostData() returns the actual post data ... I could...
Read more >How to capture http POST requests with ... - Stack Overflow
Using the following logic I can only capture the key/value pairs of the POST header but not the actual POST data (aka the...
Read more >net.lightbody.bmp.core.har.HarRequest java code examples
getDecodeValue()); if (harRequest.getPostData() != null) { if(harRequest. ... Does not populate fields within the request, * such as the error message.
Read more >net.lightbody.bmp.filters.HarCaptureFilter Maven / Gradle / Ivy
The class is part of the package ➦ Group: net.lightbody.bmp ➦ Artifact: ... file at the time this request is received (can be...
Read more >How to capture http POST requests with browsermob-proxy ...
Using the following logic I can only capture the key/value pairs of the POST header but not the actual POST data (aka the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nevermind I found the answer, I was just passing the parameter to the proxy creation instead of the HAR creation.
For other python users:
Use
proxyServer.enableHarCaptureTypes(...)
to turn a capture type on without affecting other capture types. To use an HTTP analogy,enable...
is like a POST,set...
is like a PUT. The documentation for those methods explains this pretty well.