0

I have a textbox and typing "something" and I need to select that from below list, but I am unable to find a locator to select. When I tried to inspect on listed values, the list is disappearing. So I tried using directly inside type('something{enter}'), this is working manually and surprisingly not working in automation.

Can someone advice how to select this? My textbox and html is below

enter image description here

enter image description here

  • To inspect the elements in the suggestion box you'll either have to show it using javascript in the browser console or you can use cypress test runner to take a snapshot of the DOM so you can inspect it. Here is the answer for cypress DOM snapshot. https://stackoverflow.com/a/71152206/17917809 – jjhelguero Sep 26 '22 at 15:02

1 Answers1

1

You can easily view the element with some basic debugging skills - in your test, open the dropdown, then issue command

cy.contains('Sysongkhan, Phonepasith`)
  .then($els => {
    console.log($els)  // debug to dev console
  })

Take a look at the console and observe the element structure for the best selector features (classes, ids, etc).

Maybe you just need to click after the code above if that text is unique.

Roberta D
  • 203
  • 9