-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[Question] Check if element is stable #3192
Comments
Thank you for the issue. I have a few questions 😄
|
I take separate element screenshot.
I would call it for the element that will be used for screenshot. Like this:
I believe you are thinking about child elements that could also move. If so this is not the perfect solution. But it will work for simple elements.
It happens after page loading or after some action like click. I've just found that I did not describe an example of my case. Small remark: this is not environment issue, all screenshot tests are run in docker - so OS, browser, resolution and other conditions are always the same. |
Thank you for the details! In this particular case, I think it makes sense to automatically wait for the stable position before taking an element screenshot. IIUC, it should solve your issue without any changes. As for the page screenshot, we need something more generic, but maybe |
With #3501, version 1.4 will provide the following api: await handle.waitForElementState('stable'); |
Does this method available in current playwright? |
@yksvatla It is, since version 1.4. |
Why not available in |
Hello.
I have a set of screenshot tests. Each test finds an element, creates a screenshot and compares screenshot with master screenshot of the same element. But from time to time these may fail because screenshot is being taken before animation completed. One of possible solutions is to wait for 1-2 seconds, but I don't like this way.
Looking at https://playwright.dev/#version=v1.2.1&path=docs%2Factionability.md&q=stable I can see that some actions like hover, click perform Stable check:
I do not want to use page.hover() because it may cause another page action like tooltip appear or something like this.
So I tried to find native PW method like waitForSelector that performs Stable check, but was unable to find.
Is there any way to do it?
The text was updated successfully, but these errors were encountered: