[BUG] `playwright test` with `webkit` will only lead to `browserContext.newPage: Target closed` on macOS (M1, Apple Silicon)
See original GitHub issueContext:
- Playwright Version:
1.16.3
- Operating System:
macOS 12.0.1 (21A559)
- Browser: WebKit
- Extra: ARM64
System:
- OS: macOS 11.6
- Memory: 2.85 GB / 32.00 GB
Binaries:
- Node: 16.3.0 - /usr/local/bin/node
- Yarn: 1.22.10 - /usr/local/bin/yarn
- npm: 7.7.6 - /usr/local/bin/npm
Languages:
- Bash: 5.1.4 - /usr/local/bin/bash
Code Snippet
import { expect, test } from '@playwright/test';
async function delay(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
test('twitter', async ({page}) => {
await page.goto('https://twitter.com/dan_abramov/status/1086215004808978434');
await delay(5000);
const title = await page.evaluate(() => document.title);
const text = await page.evaluate(() => document.body.textContent);
console.log('[trace] title:', title);
expect(title.startsWith('Dan on Twitter')).toBeTruthy();
console.log('[trace] text:', text);
});
Describe the bug
➜ demo_project yarn playwright test src/t.spec.ts --browser webkit
yarn run v1.22.11
$ /Users/username/Downloads/202111/temp/demo_project/node_modules/.bin/playwright test src/t.spec.ts --browser webkit
Running 1 test using 1 worker
✘ [webkit] › src/t.spec.ts:6:1 › twitter (5s)
1) [webkit] › src/t.spec.ts:6:1 › twitter ========================================================
browserContext.newPage: Target closed
1 failed
[webkit] › src/t.spec.ts:6:1 › twitter =========================================================
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
➜ demo_project
Also tested both headless / non-headless webkit on Ubuntu 20.04 (amd64), it worked well.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Puppeteer - Protocol error (Page.navigate): Target closed
What "Target closed" means. When you launch a browser via puppeteer.launch it will start a browser and connect to it.
Read more >playwright Changelog - pyup.io
As announced in v1.25, Ubuntu 18 will not be supported as of Dec 2022. ... Regression - chromium browser closes during test or...
Read more >Changelog - Cypress Documentation
In Cypress 12, we enforce running tests in a clean browser context through ... Cypress is now available natively on Apple silicon, including...
Read more >playwright._impl._api_types.error: execution context was ...
I came into this issue today, and found that this problem occurs in this case: I was use page object loading a url...
Read more >Getting Target closed error while switching to iframe - Giters
Could you provide us a full repro? Otherwise it's hard for us to act on it. For now it can be caused by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closing as a duplicate of #9811.
You can fix it by
npm i @playwright/test@1.17.0-next-alpha-nov-5-2021
or wait for 1.17.0.Thank you so much for this. I was experiencing the same issue 🤓