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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Extend IsVisibleAsync functionality to retry for a certain period of time #30500

Closed
socaciumugurel opened this issue Apr 24, 2024 · 2 comments

Comments

@socaciumugurel
Copy link

socaciumugurel commented Apr 24, 2024

馃殌 Feature Request

When you navigate to a certain website, usually, the GDPR and cookies popups take some time to be fully loaded, and they are loaded after the ("load" | "domcontentloaded") events are triggered. Sometimes they don't even appear because they have been accepted before.

Therefore a polling mechanism would be helpful in this scenario, to check every couple of milliseconds for a certain period of time (timeout) for an ILocator.

As I am new to the playwright, feel free to come up with better ideas (maybe having this mechanism in the click method).

Example

//this method will retry every 200 millisends to find the element for 3000 milliseconds. The moment the element is loaded and visible it will return true. If timeout is reached and the element is not visible, it will return false.

ILocator.IsVisibleAsync(retryInterval: 200, timeout: 3000)

Motivation

This feature will improve the performance of the library by avoiding unnecessary timeouts.

@pavelfeldman
Copy link
Member

You don't need to do anything in Playwright. Just start working with the locators and Playwright will only interact when them when they are actionable. See https://playwright.dev/docs/actionability.

@pavelfeldman
Copy link
Member

Closing as per above, please feel free to open a new issue if this does not cover your use case.

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

No branches or pull requests

2 participants