Search code examples
javascriptwebautomationplaywright

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


Solution

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

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