Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

sb.wait_for_element_visible ignores other matching elements #3904

Answered by mdmintz
Abdelgha-4 asked this question in Q&A
Discussion options

suppose a selector my_selector matches 5 elements, when calling sb.wait_for_element_visible(my_selector), currently it finds the first matching present element, then waits for it to be visible.

The behavior I want (and I expected) is to wait for any of the matching present 5 elements to be visible.

Is this behavior expected and how can I achieve the behavior I wanted?

You must be logged in to vote

There are methods for that:

sb.wait_for_any_of_elements_visible(*args, **kwargs)
sb.wait_for_any_of_elements_present(*args, **kwargs)
sb.assert_any_of_elements_visible(*args, **kwargs)
sb.assert_any_of_elements_present(*args, **kwargs)

Replies: 1 comment 2 replies

Comment options

There are methods for that:

sb.wait_for_any_of_elements_visible(*args, **kwargs)
sb.wait_for_any_of_elements_present(*args, **kwargs)
sb.assert_any_of_elements_visible(*args, **kwargs)
sb.assert_any_of_elements_present(*args, **kwargs)

You must be logged in to vote
2 replies
Comment options

Oh, I thought those methods are only for multiple elements with distinct selectors, not for single selector matching multiple elements.

So sb.wait_for_any_of_elements_visible(my_selector) will wait for any element matching my_selector to be visible, right?

Nice! Thanks a lot!

Comment options

If the same selector for multiple elements, but you just want to find the visible elements, then there’s sb.find_visible_elements(selector).

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /