gbackmania
gbackmania

Reputation: 900

How to select a dropdown option using playwright in JavaScript?

I would like to select "All" option from the below DOM using Playwright JS, and I have tried page.selectOption('select#rows per page', '-1'); and page.selectOption('id=mui-55656', '-1'); to no avail. Any help would be appreciated. Thanks. enter image description here

Upvotes: 14

Views: 49571

Answers (2)

Jason
Jason

Reputation: 117

use css mode : await page.selectOption('#mui-55656', '-1');

Upvotes: -1

hardkoded
hardkoded

Reputation: 21695

You should be able to select the option using the aria-label

await page.selectOption('[aria-label="rows per page"]', '-1');

Upvotes: 20

Related Questions