We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
label
locator.selectOption
While working on fixing panic from grafana/xk6-browser#1415 (PR grafana/xk6-browser#1552) we figured out that the locator.selectOption also currently doesn't support selecting by label if it's a string input, the cases like:
<select name="numbers" id="numbers-options" multiple> <option value="zero">Zero</option> <option value="one">One</option> <option value="two">Two</option> <option value="three">Three</option> <option value="four">Four</option> <option value="five">Five</option> </select>
await options.selectOption(['Two', 'Four']); // labels await options.selectOption('Five'); // label
The playwright does support that https://playwright.dev/docs/api/class-locator#locator-select-option
As the workaround for now (if grafana/xk6-browser#1552 merged) you could use object definition, like:
import { browser } from 'k6/browser'; export const options = { scenarios: { browser: { executor: 'shared-iterations', options: { browser: { type: 'chromium', }, }, }, }, }; export default async function () { const page = await browser.newPage(); await page.goto('https://test.k6.io/browser.php'); const options = page.locator('#numbers-options'); await options.selectOption([{label:'One'}, {label:'Three'}]); // multiply labels await page.screenshot({ path: 'screenshots.png' }); }
It's expected to also be able to select options by label.
The text was updated successfully, but these errors were encountered:
Hi @ankur22 , @olegbespalov . Interested to work on this issue, Wanted to check if I could contribute to this
Sorry, something went wrong.
ankur22
No branches or pull requests
What?
While working on fixing panic from grafana/xk6-browser#1415 (PR grafana/xk6-browser#1552) we figured out that the
locator.selectOption
also currently doesn't support selecting by label if it's a string input, the cases like:The playwright does support that https://playwright.dev/docs/api/class-locator#locator-select-option
Workaround
As the workaround for now (if grafana/xk6-browser#1552 merged) you could use object definition, like:
Why?
It's expected to also be able to select options by label.
The text was updated successfully, but these errors were encountered: