Rayrun
← Back to Discord Forum

please how i can a select a country in dropdown menu for registration since the country is down belo

i've tried to select option after clicking but it's still not working

This thread is trying to answer question "How can I select a country in a dropdown menu for registration?"

10 replies

@here

please how i can a select a country in dropdown menu for registration since the country is down belo

You could take a value as locator, and filter by text eg. page.locator('some-locator', {hasText: 'the value that you need'})

i have to click on the option before selecting i guess @_flevi

is it good to use playwriht codegen

codegen is a starting point, but from there you need to refine it you should try something like:

  1. page.locator('#dropdown-id').click() to open it
  2. page.locator(''probably-some-li', {hasText: 'the value that you need'}).click() to select it The value should be either in a <li>, <div>, <p>... depending on the type of dropdown identefy that and you can filter by text

Thanks

@_flevi

tphillips8117
@_godsown: Don't ping everyone, and be patient! 😄

Don't ping everyone, and be patient! 😄

First check that the options in the dropdown is lazyload or what? because playwright can't select it if it lazyload and then you should make a scroll for it to be visible then select

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 [email protected].