I'm writing small bot using Selenium WebDriver. Is it possible to capture data from response of XmlHttpRequests using browsermob-proxy or any different way? I need to inspect received data from POST/GET queries. Actually question more related to functionality of browsermob-proxy and I couldn't find an answer.
Asked
Active
Viewed 5,476 times
15
-
1were u able to find answer to this question? – proprius Jan 07 '16 at 06:10
-
Any updates on this question? – Dimitri Jan 09 '19 at 18:29
-
with a proxy, yes – Corey Goldberg May 22 '19 at 22:53
2 Answers
2
I believe the answer is no, but you could have Selenium execute javascript to send the post/get and retrieve the response headers... I use something like this to display errors (jqXHR is jQuery's response XML object: http://api.jquery.com/jQuery.ajax/#jqXHR)
$.post(destURL, formresult, function (data) {
//... process return data
}).fail(function (jqXHR, textStatus, error) {
DisplayError(jqXHR, textStatus, error);
});

pcalkins
- 1,188
- 13
- 20
-1
I can only imagine the usual methods to intercept AJAX calls with Javascript or GreaseMonkey. I had fine results with this solution: https://stackoverflow.com/a/6805461/3034120 You can replace the output to log to create a div and fill it with the responses for example. Then you could read that out with Selenium.

Community
- 1
- 1

AlvaHenrik
- 404
- 2
- 10
-
Has anyone tried this with selenium and verify this worked? (asking because no upvotes) – Happy Bird Aug 19 '18 at 15:14
-
That's not really what is asked here. Anyone maybe have a solution with Python and Selenium? – Dimitri Jan 09 '19 at 18:29