0

Sample

Here the id=popupY8cuUiMiDU is dynamic.I need to get the Y value from span but there are multiple listbox with the same span attribute taking Y option. How can I select from listbox as there is no unique attribute?

1

1 Answer 1

1

There're a few options.

  1. getting the element by what's not dynamic in its id

    //div[contains(@id, "popup")]

  2. using CSS

    .ui-dropdown-panel.ui-widget-content.ui-corner-all.ui.shadow

  3. asking developers to build in a unique test id for you

    e.g. there could be something like data-test-id=popup, then you'd use a css selector like so: [data-test-id=popup]


There could be more options, you can get more creative etc. But I'd keep it as simple as possible, which promotes maintainability and readability.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.