2

The web application that i need to test contains following JS snippet

 $.ajax({
        url : "getData",
        method : 'post',
        data: "abc",
        success : function(response) {
                    $(response).each(function(index, value) {
                        // do something
                    });
        }
 });

I need to verify the data in this response using Selenium. I not able to find a way to get this response using Selenium. Please give me suggestions if anyone has encountered similar issues.

PS: I cant make chages to web-app. I'm just a tester.

Nitish Vasu
  • 49
  • 2
  • 11
  • 1
    Selenium doesn't support this. But you can try a workaround by setup a proxy server (https://github.com/lightbody/browsermob-proxy) , then configure the webdriver to use the proxy. See more at: http://sqa.stackexchange.com/questions/1276/is-there-a-capturenetworktraffic-implementation-in-selenium-2-via-webdriver – Buaban Feb 18 '16 at 09:55
  • @Buaban So it's possible. https://stackoverflow.com/questions/44642636/how-to-get-data-from-ajax-request-in-selenium?noredirect=1#comment77344301_44642636 – Alex78191 Jul 19 '17 at 11:43
  • @Alex78191 no, it's not possible. As I mentioned, you must be the owner and modify code to expose some javascript variables in the application. – Buaban Jul 19 '17 at 12:56
  • @Buaban it's possible to change the function – Alex78191 Jul 19 '17 at 12:58

0 Answers0