<p dir="auto"><strong>Context:</strong></p>
<ul dir="auto">
<li>Playwright Version: <code class="notranslate">1.16.3</code></li>
<li>Operating System: <code class="notranslate">macOS 12.0.1 (21A559)</code></li>
<li>Browser: WebKit</li>
<li>Extra: ARM64</li>
</ul>
<h3 dir="auto">System:</h3>
<ul dir="auto">
<li>OS: macOS 11.6</li>
<li>Memory: 2.85 GB / 32.00 GB</li>
</ul>
<h3 dir="auto">Binaries:</h3>
<ul dir="auto">
<li>Node: 16.3.0 - /usr/local/bin/node</li>
<li>Yarn: 1.22.10 - /usr/local/bin/yarn</li>
<li>npm: 7.7.6 - /usr/local/bin/npm</li>
</ul>
<h3 dir="auto">Languages:</h3>
<ul dir="auto">
<li>Bash: 5.1.4 - /usr/local/bin/bash</li>
</ul>
<h3 dir="auto">Code Snippet</h3>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { expect, test } from '@playwright/test';

async function delay(ms: number) {
  return new Promise((resolve) =&gt; setTimeout(resolve, ms));
}
test('twitter', async ({page}) =&gt; {
  await page.goto('https://twitter.com/dan_abramov/status/1086215004808978434');

  await delay(5000);

  const title = await page.evaluate(() =&gt; document.title);
  const text = await page.evaluate(() =&gt; document.body.textContent);

  console.log('[trace] title:', title);
  expect(title.startsWith('Dan on Twitter')).toBeTruthy();
  console.log('[trace] text:', text);
});"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">expect</span><span class="pl-kos">,</span> <span class="pl-s1">test</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'@playwright/test'</span><span class="pl-kos">;</span>

<span class="pl-k">async</span> <span class="pl-k">function</span> <span class="pl-en">delay</span><span class="pl-kos">(</span><span class="pl-s1">ms</span>: <span class="pl-smi">number</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-k">new</span> <span class="pl-smi">Promise</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">resolve</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-en">setTimeout</span><span class="pl-kos">(</span><span class="pl-s1">resolve</span><span class="pl-kos">,</span> <span class="pl-s1">ms</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">'twitter'</span><span class="pl-kos">,</span> <span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">{</span>page<span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span><span class="pl-s">'https://twitter.com/dan_abramov/status/1086215004808978434'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-k">await</span> <span class="pl-en">delay</span><span class="pl-kos">(</span><span class="pl-c1">5000</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-k">const</span> <span class="pl-s1">title</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">evaluate</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">document</span><span class="pl-kos">.</span><span class="pl-c1">title</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">const</span> <span class="pl-s1">text</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">evaluate</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-smi">document</span><span class="pl-kos">.</span><span class="pl-c1">body</span><span class="pl-kos">.</span><span class="pl-c1">textContent</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'[trace] title:'</span><span class="pl-kos">,</span> <span class="pl-s1">title</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-en">expect</span><span class="pl-kos">(</span><span class="pl-s1">title</span><span class="pl-kos">.</span><span class="pl-en">startsWith</span><span class="pl-kos">(</span><span class="pl-s">'Dan on Twitter'</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toBeTruthy</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'[trace] text:'</span><span class="pl-kos">,</span> <span class="pl-s1">text</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Describe the bug</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="➜  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"><pre class="notranslate"><code class="notranslate">➜  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
</code></pre></div>
<p dir="auto">Also tested both headless / non-headless webkit on Ubuntu 20.04 (amd64), it worked well.</p>
<h3 dir="auto">Fix: <code class="notranslate">npm i -D @playwright/test@1.17.0-next-alpha-nov-5-2021</code>.</h3>
<p dir="auto">It gets included in version 1.17.0.</p>
<hr>
<p dir="auto"><strong>Context:</strong></p>
<ul dir="auto">
<li>Playwright Version: 1.16.1</li>
<li>Operating System: MacOS Monterey 12.0.1</li>
<li>Node.js: 14.18.0</li>
<li>Browser: Webkit</li>
</ul>


<p dir="auto"><strong>Code Snippet</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const myContext = await browser.newContext();"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">myContext</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">browser</span><span class="pl-kos">.</span><span class="pl-en">newContext</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Describe the bug</strong></p>
<p dir="auto">Since latest upgrade of MacOS (Monterey 12.0.1) all my tests fail with webkit browser (headless or not).<br>
The fail is detected when instantiating <code class="notranslate">browser.newContext()</code> with the following error: <code class="notranslate">browser.newContext: Target closed</code></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1481595/139021226-e02f76bb-63d7-47af-b564-24e5b1803b2a.jpg"><img src="https://user-images.githubusercontent.com/1481595/139021226-e02f76bb-63d7-47af-b564-24e5b1803b2a.jpg" alt="CleanShot 2021-10-27 at 09 37 53@2x" style="max-width: 100%;"></a></p>
<p dir="auto">This is only with webkit, everything was ok before the MacOS upgrade, and everything is ok with Firefox and Chromium.</p>