Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix isHidden #1110

Merged
merged 4 commits into from
Nov 23, 2023
Merged

Fix isHidden #1110

merged 4 commits into from
Nov 23, 2023

Conversation

ankur22
Copy link
Collaborator

@ankur22 ankur22 commented Nov 22, 2023

What?

This fixes isHidden so that it does not wait for an element to match with the given selector, and returns straight away. This makes the timeout option obsolete.

Why?

There are two reason to make this change:

  1. It doesn't make sense to wait for an element to match before checking whether it is hidden;
  2. It will match Playwrights behaviour which is what some users will expect.

Checklist

  • I have performed a self-review of my code
  • I have added tests for my changes
  • I have commented on my code, particularly in hard-to-understand areas

Related PR(s)/Issue(s)

Updates: #981

common/frame.go Outdated Show resolved Hide resolved
common/frame.go Outdated Show resolved Hide resolved
tests/page_test.go Show resolved Hide resolved
When runActionOnSelector cannot find a matching element for a given
selector, it should defer the boolean response back to the caller as it
will be different depending on the context. For isVisible it will be
false but for isHidden it will be true.
isHidden will now work with runActionOnSelector just like isVisible.
This means that isHidden will not wait for the selector to match on an
element before returning the result. It doesn't make sense for the API
to wait for an element to match before checking whether it is hidden
or not.

Note that when no matches are found for the selector, it return true
instead of false, which is to say that the element is hidden (or
hasn't been found).

This makes timeout obsolete for isHidden too, just like it is for
isVisible.
To avoid stuttering, avoid wrapping the error again.
@ankur22 ankur22 merged commit 8f8070f into main-next Nov 23, 2023
14 checks passed
@ankur22 ankur22 deleted the fixAndRefactor/isHidden branch November 23, 2023 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants