How to select ant desing select option with playwright or cypress
The Playwright Element Handle has the Query All Selector. If at least a part of the xpath stays the same, you can use the $$
selector.
The function will return <Promise<Array<ElementHandle>>>
which you may then resolve and hook onto the index of the selection you want to make.
For instance -
const selector = "//div[contains(@attribute, 'selection-options-partial-id-text')]" const allSelectionOptions = await page.$$(selector);await allSelectionOptions[index].click();
This will work, assuming that all the options under Select
must have a common portion in their xpath, or if defined, their data-test-id
.