grafana / xk6-browser

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

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

Open robingustafsson opened 2 years ago

robingustafsson commented 2 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 5 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.