Getting - Error: locator.click: Error: strict mode violation: getByRole('option') resolved to 3 elements: in Playwright typescript

15 views Asked by At

In the GUI 1, there is a dropdown1 and a name field. When the user selects 'value1' from dropdown1, it will display dropdown2 and a number field(GUI 2). I need to create various test scenarios such as:

  1. If the user selects 'value 1' from dropdown1, they should provide a new name. Then, the user needs to select 'DD Value 1' from dropdown2 and fill in the number field.
  2. If user selects 'value 1' from dropdown1, they should provide a new name. Then, the user needs to select 'DD Value 2' from dropdown2 and fill the number field

This process should iterate to create all possible scenarios. GUI 1 GUI 2

I've added for loops to run through the dropdowns and get values but I'm getting Error: locator.click: Error: strict mode violation: getByRole('option') resolved to 3 elements: in Playwright typescript and I'm unable to select the exact item from the dropdown.

0

There are 0 answers