15

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.

tsaulic
  • 707
  • 1
  • 11
  • 22
Alexander
  • 235
  • 2
  • 9

2 Answers2

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