rendertron icon indicating copy to clipboard operation
rendertron copied to clipboard

Add timeout options for screenshots

Open mcorbe opened this issue 2 years ago • 2 comments

For Digital Signage purposes, we have HTML Creatives that changes after domcontentloaded in order to make sure we never display black or loading screens. We do not build these Creatives and cannot optimize the code / makes sure the content is fully painted before domcontentloaded event.

We would like to add a timeout option around the page.screenshot(...) puppetteer call so that we can ensure our screenshots are taken at the right time.

Here is an issue from puppeteer github with a proposed solution:

https://github.com/puppeteer/puppeteer/issues/2117

Happy to create an MR if that helps.

mcorbe avatar May 10 '22 09:05 mcorbe

Hi,

I think that perhaps there's some misunderstanding here. While having a timeout for taking a screenshot is great, this can easily be implemented on the developers side.

The original issue that I think people were asking for a fix for, was a timeout for if the screenshot fails/doesn't return within a certain period, for example, if you await page.screenshot() and then it never returns (IE, page context changed or went away) then your stuck hanging forever.

One could implement a promise timeout for this however it doesn't ensure that the call won't return in the future even after a timeout (unless it's truly and permanently hung) and is a different pattern than all other functions that have a timeout option to reject if not completed within the timeout.

ForbiddenEra avatar May 20 '22 08:05 ForbiddenEra

Also should mention that for your particular issue, you can wait for a specific element to be available, this is for example what we do on a page where content is loaded dynamically (a form) where we need to enter data.

ForbiddenEra avatar May 20 '22 19:05 ForbiddenEra

In general, as we're deprecating the project, you should look into alternative approaches to rendering on the web.

AVGP avatar Oct 06 '22 07:10 AVGP