xk6-browser icon indicating copy to clipboard operation
xk6-browser copied to clipboard

Implement `BrowserContext.addInitScript(script[, arg])`

Open robingustafsson opened this issue 4 years ago • 0 comments

Add support for BrowserContext.addInitScript(script[, arg]), to set script to run on every new page creation or navigation nd every new frame attachment in browser context.

Relevant links:

  • Playwright docs: https://playwright.dev/docs/api/class-browsercontext#browser-context-add-init-script
  • xk6-browser code starting point: https://github.com/grafana/xk6-browser/blob/main/common/browser_context.go#L81 (the actual execution of the code on page creation/navigation or frame attachement is not implemented)
  • Playwright code: https://github.com/microsoft/playwright/blob/master/packages/playwright-core/src/server/chromium/crBrowser.ts#L447
  • Playwright tests: https://github.com/microsoft/playwright/blob/master/tests/browsercontext-add-init-script.spec.ts

robingustafsson avatar Sep 30 '21 09:09 robingustafsson