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
343 stars 41 forks source link

`args` option on `Launch` doesn't seem to append to the args when launching the browser #461

Closed ankur22 closed 2 years ago

ankur22 commented 2 years ago

Tested against: https://github.com/grafana/xk6-browser/commit/dbede120c63df43995813a847a25b0e66e289592

I was testing the Launch function with the following script as I was testing the args option:

import { sleep } from 'k6';
import launcher from 'k6/x/browser';

export default function () {
  const browser = launcher.launch('chromium', {
    args: ['--show-property-changed-rects'],
    headless: false,
  });
  const context = browser.newContext();
  const page = context.newPage();
  const res = page.goto('https://maps.google.com');

  sleep(10);
  browser.close();
}

I was expecting coloured boxes to appear on screen as I hovered the mouse on the page like so:

Screenshot 2022-07-15 at 14 13 32 (2)

But this didn't happen and no boxes displayed anywhere.

inancgumus commented 2 years ago

This feature works. The argument should be without dash-dash as follows:

const browser = launcher.launch('chromium', {
  args: ['show-property-changed-rects'],
  headless: false,
});