grafana / xk6-browser

The browser module adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol to k6.
https://grafana.com/docs/k6/latest/javascript-api/k6-browser/
GNU Affero General Public License v3.0
344 stars 41 forks source link

Implement `route(url, handler[, options])` #10

Open robingustafsson opened 3 years ago

robingustafsson commented 3 years ago

Add support for BrowserContext.route(url, handler[, options]), to enable request interception allowing any request initiated in the browser context to be modified. A request with a matching URL will stall until continued, fulfilled or aborted.

Relevant links:

Tasks:

tmc commented 1 year ago

Relatedly, I think this should be exposed on Page as well.

inancgumus commented 10 months ago

@tom-miseur: This is essentially a way to intercept requests before they get sent, which is useful for setting URL/route-specific headers. With page.setExtraHttpHeaders. You often run into CORS issues as the headers are applied across all requests.

gbolo commented 1 month ago

Wondering if this will also be useful in intercepting requests to favico and aborting them so the logs are not filled with 404s for those calls ;)