Get GET requests using Javascript in Firefox Console

Is there a way to get the details of GET requests for a web page using JavaScript? I do not mean the parameters of the current page URL, but the outgoing requests are GET.

Example: If you open the google start page with firefox and switch the developer tools, on the Network tab you can see a series of GET requests, for example, for a logo that looks like https://www.google.com/images/branding/ googlelogo / 1x / googlelogo_color_272x92dp.png

I want to get this url on the console tab using javascript. Is it possible to get it through an object attached to the DOM ( document ) or specification ( window )?

The reason for my question is: I am in a test automation environment where developer tools are not available. Only JavaScript is available, and I need to check the URL of the GET request issued by the current page. I just mentioned the developer tools because it is the easiest way to reproduce the problem (and the easiest way to check if the solution works). But this is more about Firefox / HTTP than test automation itself.

+5
source share
1 answer

I do not think this is possible in devtools, but you can use regular JS to make a global event handler (if it is jQuery) or, if you use regular JS, replace the XmlHttpRequest object with a duckpunched object that registers the result, as described here .

0
source

Source: https://habr.com/ru/post/1239975/


All Articles