#39 Playwright with Python | Select single select dropdown in Playwright

Опубликовано: 27 Март 2026
на канале: AutomationNeemo
2,945
38

#playwright
#pytest
#python
How to select single select list by index in Playwright
How to select a single select list by visible text in Playwright
How to select a single select list by value in Playwright
How to deselect a single select list in Playwright

URL- https://selenium08.blogspot.com/2019/...
Github repo URL- https://github.com/automationneemo/Pl...

Code:

Go to https://selenium08.blogspot.com/2019/...
page.goto("https://selenium08.blogspot.com/2019/...")
page.locator("//select[@name='country']").select_option(label="India")
page.wait_for_timeout(2000)
page.locator("//select[@name='country']").select_option(value="KH")
page.locator("//select[@name='country']").select_option(index=5)
page.locator("//select[@name='country']").select_option("")
page.wait_for_timeout(4000)