Skip to content

Commit

Permalink
browser: Add page on request example
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Feb 24, 2025
1 parent 8f76910 commit 2c5f7b2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/browser/pageon-request.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { browser } from 'k6/browser'

export const options = {
scenarios: {
ui: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
}

export default async function () {
const page = await browser.newPage()

// registers a handler that logs all requests made by the page
page.on('request', async request => console.log(request.url()))

await page.goto('https://quickpizza.grafana.com/', { waitUntil: 'networkidle' })

await page.close();
}

0 comments on commit 2c5f7b2

Please sign in to comment.