-
Notifications
You must be signed in to change notification settings - Fork 197
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
Need to wait for a paint before taking a screenshot #895
Comments
Related to #893. |
This is related to #893 but somewhat different because it isn't about resources that aren't loaded by |
Would adding the step
from the Element Click command help? We are somewhat vague about what that means, but in practice, what Marionette does wait for interaction.flushEventLoop = function* (win) {
let unloadEv;
return new Promise((resolve, reject) => {
if (win.closed) {
reject();
return;
}
unloadEv = reject;
win.addEventListener("unload", unloadEv, {once: true});
win.requestAnimationFrame(resolve);
}).then(() => {
win.removeEventListener("unload", unloadEv);
});
}; |
No. In gecko terms we should wait for MozAfterPaint (although I think that rAF is equivalent). But I'm not sure if it's guaranteed that a paint actually happens before that runs. The spec sort of implies that it probably ought to, but maybe in practice it doesn't. |
Starts to address w3c#895
We couch this in the language of `requestAnimationFrame` so that we can be sure that there are no pending paint events. This does not guarantee that all resources on the page are fully laoded. This also brings the language used in `Take Element Screenshot` into line with the language used in `Take Screenshot` by using `trying` instead of checking the return value. Starts to address w3c#895
We couch this in the language of `requestAnimationFrame` so that we can be sure that there are no pending paint events. This does not guarantee that all resources on the page are fully laoded. This also brings the language used in `Take Element Screenshot` into line with the language used in `Take Screenshot` by using `trying` instead of checking the return value. Starts to address #895
We now using the same language as |
We couch this in the language of `requestAnimationFrame` so that we can be sure that there are no pending paint events. This does not guarantee that all resources on the page are fully laoded. This also brings the language used in `Take Element Screenshot` into line with the language used in `Take Screenshot` by using `trying` instead of checking the return value. Starts to address w3c#895
@Hexcles and I are discussing how to deal with https://crbug.com/507054 and need to understand the exact timing of Take Screenshot to do that.
@jgraham, this isn't the case I think. rAF is a before layout/paint callback, as can be seen in https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering. "run the animation frame callbacks" comes before "update the rendering" with no async-y bits in between, so AFAICT the current WebDriver spec guarantees that the screenshot is right before the next paint, if we take "update the rendering" to mean paint. (@chrishtr, is that right?) The way that "Take Screenshot" is implemented in ChromeDriver is to force a redraw in paint, here: So... I think that to match this WebDriver would be to, in the "remote end steps", not say "When the user agent is next to run the animation frame callbacks" but rather have a hook after the last step of the "update the rendering" steps in HTML. And perhaps something to cause those steps to run, since they may never run again otherwise. @andreastt, would that match what's implemented in GeckoDriver and Marionette, or what timing do you have? |
Gecko doesn’t currently have any synchronisation, i.e. does not conform to WebDriver here. |
Will it just grab whatever was last painted then, so not forcing a new layout or paint? Do you think that's a better behavior? |
jugglinmike/chrome-screenshot-race#1 details an issue where using ChromeDriver to take screenshots on page load produces unreliable behaviour because it isn't waiting for the content to paint before taking the screenshot. The specification should require webdriver implementations to wait for a paint before taking the screenshot, otherwise the implementation isn't reliable.
cc @jugglinmike
The text was updated successfully, but these errors were encountered: