-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[BUG] Page.screenshot method hangs indefinitely #28995
Comments
I can repro, hangs for me with: await page.goto("chrome://crash").catch(e => console.log(e));
await page.screenshot({ path: `crash.png` }) at:
|
I have the same issue, when I pass And this issue has probably the same root cause: #29968 If you have an idea how to somehow force a timeout on loading the fonts? |
Hi. I'm facing similar issue - sometimes my tests are getting stuck when i'm tryigng to take screenshot. I'm using Playwright 1.42.0. I've investigated logs using DEBUG=pw:* and i can see that right after calling page.screenshot playwright logs
which is followed by a bunch of usually these SEND requests recieve immediate response like:
but sometimes it takes several minutes - this is clearly causing problems and leads to hanging screenshot method. Ofc screenshot method throws a timeout but subsequent screenshot calls from the same browser context seem to be affected and it's basically not possible to capture screenshot anymore. It seems to be somewhat related with #29968 I hope that this will help to find the root cause and fix the problem... |
I have a similar issue. In "headless" mode there is no problem, but in "headed" mode every test stucks at taking a screenshot (interestingly, a week ago it was working more or less fine - the tests only stucked on one screenshot and all you had to do was give Now, in my case, a workaround works - I gave this before each test test.beforeEach(async ({ page }) => {
await page.route('**/*.css', (route) => { route.abort(); });
}); and it looks like everything is working fine. |
I am also experiencing this "waiting for fonts to load" bug in headed mode that leads to a hanging page.screenshot command, but can confirm that in headless mode everything works fine. However in some cases I need to be in headed mode -- is there any way to fix this bug? |
except Exception as error:
E Call log: Still getting this issue.. the same methods works in some pages of headed, but stucks at some of the new test cases. |
Was getting this too (and only on some pages, while on others worked)... Found out about it by inspecting the
|
It would be really amazing to have a list of these env variables as they're pretty amazing but you only find them if you dig through the source code. I can also confirm is solves my problems. |
Worked for me as well thank you @azrafe7 |
@Rafiot @charlesloubao would it be possible to share a repro with us? |
I get that fairly consistently on |
@Rafiot could you help us a with a repro? I tried the following and it works for me: import { chromium } from 'playwright';
(async () => {
const browser = await chromium.launch({ headless: true });
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://liberation.fr');
await page.waitForTimeout(10_000);
await page.screenshot({ fullPage: true, path: 'screenshot.png' });
await context.close();
await browser.close();
})(); |
I'll not have time to work on that today, sorry. Hopefully early next week. If that's important, I'm using the new headless (which is very similar to headfull, afaict). |
I don't seem to be able to reproduce it anymore. |
Glad someone else managed to give you a proper test, and I confirm I can reproduce too (even without slomo setting). I'm super curious to know what's causing that. |
@pavelfeldman as you have implemented this "wait for fonts" stuff in #28226, can you briefly explain how it's supposed to work? |
… frame / page main frame (#31295) **Investigation** ~~We use `nonStallingEvaluateInExistingContext` as of today, which does `eval()` inside (from our utilityScript) which breaks for some sites. It causes a hang, since the returned `Promise` of `eval()` hangs. We don't know as of today why this happens. Without wrapping it ini `eval()` it does not hang.~~ ~~Workaround: Do a plain Runtime.evaluate instead.~~ workaround: Only wait on main frame. Relates #28995 (keeping it open until they confirm that it helps)
We landed a fix in Canary, feel free to try or wait for 1.45. I'll close it for now, for further bug reports in Canary / 1.45 (to be released) please file new bug reports - thank you for your understanding! |
I use 1.48 but still got this error |
I use Ping @mxschmitt |
System info
Source code
Link to the GitHub repository with the repro
Test file (self-contained)
Steps
Expected
The for loop runs all the way through and not crash.
The
page.screenshot
runs normally.Actual
At the 2652 iteration, a Timeout exception gets caught. Chrome gets an Out of Memory error.
The code hangs at the
page.screenshot
line and never completes.Screenshot
The text was updated successfully, but these errors were encountered: