Rayrun
← Back to Discord Forum

locate an element label for

Hi, I would like to a click a elment but can't quite work out how to use getbyrole, getbylabel or xpath that ends with size_0 .

Have tried the auto picker but seems to default to a getbytext value which is no good for my scenario of clicking first size on page that may be different each time

<label for="ad7ei_size_0">

This thread is trying to answer question "How can I click an element using getbyrole, getbylabel or xpath that ends with size_0?"

3 replies

maybe this can help:https://playwright.dev/docs/api/class-locator#locator-get-by-label await page.getByLabel(/_size_0/) ?

label[for$='_size0']

Thank you for your time and answers. @dand33 solution is working.

20230721_101124.jpg

Related Discord Threads

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.