3

When attempting to use page.SelectOption with Playwright, im getting an issue where my chosen value is not being selected, it doesnt matter if I use index, value, or label to try to select.

I know the selector is being found as when I debug using trace viewer I cant see that the step shows: enter image description here

However on the select box it doesn't change and acts like it hasn't selected anything.

enter image description here

code used: await page.selectOption('#select', "2");

OrdinaryKing
  • 411
  • 1
  • 7
  • 16

1 Answers1

3

Another way of doing the above is:

const selector = await page.$("#select")

await selector?.selectOption("2")

However the original did work for me, there seems to be a bug with traceviewer where the after shot does not show the selected option. Github issue raised:

https://github.com/microsoft/playwright/issues/9212

OrdinaryKing
  • 411
  • 1
  • 7
  • 16