3

I'm testing a webpage using Selenium (either IDE or webdriver). The webpage has a "search" function, basically just a GET call with params. The javascript also output to console the JSON returned from the search call, i.e. something like console.log(data). And I'm able to inspect the response data in Firefox console.

My question is: is there anyway I can capture this data from Firefox console in Selenium (so that I can further inspect and doing asserts)? Writing a direct GET request (eg, from Python) does not work since the search url is protected through a login page.

Thanks.

xysun
  • 1,995
  • 18
  • 18
  • Possible duplicate of [Getting console.log output from Chrome with Selenium Python API bindings](http://stackoverflow.com/questions/20907180/getting-console-log-output-from-chrome-with-selenium-python-api-bindings) – Cynic Jan 05 '17 at 18:48

2 Answers2

0

AFAIK Selenium doesnt provide any in built API/method to play with console.
You can redirect console output file and read from file.
Link: How to redirect Firefox console output to file.

Ajinkya
  • 22,324
  • 33
  • 110
  • 161
0

It was possible at one point using Firebug. Not sure if it still works.

faddison
  • 101
  • 1
  • 6