Rayrun
← Back to Discord Forum

Dropdown Locator

Hi all, I'm new at automation and new here so I hope this is an okay question for this server. I'm trying to select an option (highlighted one) from dropdown in the picture, but however I do it, I get a timeout for waiting for a locator. So, my question is what's the best practice for code such as this, how to best pinpoint a locator (in .NET)? Thanks!

image.png

This thread is trying to answer question "What's the best practice for pinpointing a locator in .NET when selecting an option from a dropdown?"

6 replies

did you try to use the code generator / playwright runner to identify a locator for that?

when in doubt, I use it to test different locators and see which one works best... if you stop recording, you can enter the locator manually and see what it finds

@rmjoia: How would I go about doing that? I usually just inspect the element and try to find a locator there

How would I go about doing that? I usually just inspect the element and try to find a locator there

tphillips8117

If you're using vscode, install the Playwright extension. Then use either "Pick Locator" or one of the recording options:

image.png
tphillips8117

Outside VSCode, use UI mode in playwright to give you the "Pick Locator" option

@obihobit: https://playwright.dev/docs/codegen Using the VS Code Extension: https://playwright.dev/docs/codegen#generating-locators Using the test genrator to pick locators: https://playwright.dev/docs/codegen
@rmjoia: wow thanks, I never knew this existed, I'll have to try it out

wow thanks, I never knew this existed, I'll have to try it out

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.