Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to capture XHR response data using WebDriver

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.

like image 294
Alexander Avatar asked Dec 05 '12 15:12

Alexander


1 Answers

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);


});
like image 71
pcalkins Avatar answered Oct 11 '22 17:10

pcalkins