Context:
- Playwright Version: 1.10.0
- Operating System: MacOS 11.3
- Node.js version: 15.11.0
- Browser: Chromium (works fine w/ Firefox)
Code Snippet
- Create the following HTML file in your local webserver's DocumentRoot:
<a href="test.pdf" target="_blank">Link to PDF file</a>
-
Put a PDF file with the name "test.pdf" in the same directory.
-
Run the following PW code:
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({
headless: true,
});
const context = await browser.newContext();
const page = await context.newPage();
await page.setViewportSize({
width: 1200,
height: 1200,
});
await page.goto('localhost/a.html');
const [pagePDF] = await Promise.all([
context.waitForEvent('page'),
await page.click('text=Link to PDF file'),
]);
await pagePDF.waitForLoadState();
console.log('Load state reached.');
await browser.close();
})();
Describe the bug
After 30 seconds you will get the following error message:
/[...]/node_modules/playwright/lib/client/waiter.js:57
const result = await Promise.race([promise, ...this._failures]);
^
TimeoutError: page.waitForLoadState: Timeout 30000ms exceeded.
=========================== logs ===========================
"networkidle" event fired
============================================================
Note: use DEBUG=pw:api environment variable to capture Playwright logs.
at /[...]/node_modules/playwright/lib/client/waiter.js:49:51
at Waiter.waitForPromise (/[...]/node_modules/playwright/lib/client/waiter.js:57:28)
at /[...]/node_modules/playwright/lib/client/frame.js:150:13
at Frame._wrapApiCall (/[...]/node_modules/playwright/lib/client/channelOwner.js:77:28)
Process finished with exit code 1
The expected behavior is instead to get the following console log messages:
Load state reached.
Process finished with exit code 0
The above code works fine when run with Chromium in headful mode or when run with Firefox either in headless or headful mode.
Context:
Code Snippet
Put a PDF file with the name "test.pdf" in the same directory.
Run the following PW code:
Describe the bug
After 30 seconds you will get the following error message:
/[...]/node_modules/playwright/lib/client/waiter.js:57 const result = await Promise.race([promise, ...this._failures]); ^ TimeoutError: page.waitForLoadState: Timeout 30000ms exceeded. =========================== logs =========================== "networkidle" event fired ============================================================ Note: use DEBUG=pw:api environment variable to capture Playwright logs. at /[...]/node_modules/playwright/lib/client/waiter.js:49:51 at Waiter.waitForPromise (/[...]/node_modules/playwright/lib/client/waiter.js:57:28) at /[...]/node_modules/playwright/lib/client/frame.js:150:13 at Frame._wrapApiCall (/[...]/node_modules/playwright/lib/client/channelOwner.js:77:28) Process finished with exit code 1The expected behavior is instead to get the following console log messages:
Load state reached. Process finished with exit code 0The above code works fine when run with Chromium in headful mode or when run with Firefox either in headless or headful mode.