Skip to content

The selectOption method on frame only selects one option #4430

Open
@ankur22

Description

@ankur22

Tested against: grafana/xk6-browser@dbede12

The selectOption method on locator only selects one option.

In the below code it works against localhost:8080, which is a test server that can be found here with instructions on how to run it locally: https://github.com/ankur22/testserver.

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

export default function () {
  const browser = launcher.launch('chromium', {
    headless: false,
  });
  const context = browser.newContext();
  const page = context.newPage();
  const res = page.goto('http://localhost:8080/other');
  const l = page.locator('#cars-options');
  sleep(1);
  l.selectOption(['land rover', 'ferrari']);

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

I was expecting it to select two options on the test page, but it only selected the first one.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions