<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: 1.32</li>
<li>Operating System: Mac</li>
<li>Browser: [All, Chromium, Firefox, WebKit]</li>
<li>Other info:</li>
</ul>
<h3 dir="auto">Source code</h3>
<ul dir="auto">
<li>[x ] I provided exact source code that allows reproducing the issue locally.</li>
</ul>




<p dir="auto"><strong>Test file (self-contained)</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="it('should check the box using setChecked', async ({ page }) =&gt; {
  await page.setContent(`&lt;input id='checkbox' type='checkbox'&gt;&lt;/input&gt;`);
  await page.getByRole('checkbox').check();
  await expect(page.getByRole('checkbox')).toBeChecked();
});"><pre class="notranslate"><span class="pl-en">it</span><span class="pl-kos">(</span><span class="pl-s">'should check the box using setChecked'</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">setContent</span><span class="pl-kos">(</span><span class="pl-s">`&lt;input id='checkbox' type='checkbox'&gt;&lt;/input&gt;`</span><span class="pl-kos">)</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">getByRole</span><span class="pl-kos">(</span><span class="pl-s">'checkbox'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">check</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">await</span> <span class="pl-en">expect</span><span class="pl-kos">(</span><span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">getByRole</span><span class="pl-kos">(</span><span class="pl-s">'checkbox'</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toBeChecked</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><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>npx playwright test --ui</li>
<li>close ui from the ui</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">Playwright should close all instances of browser once UI is closed</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">Stays open in your dock and the more you open the UI the more browser instances it stores</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/13063165/227214901-9c1bf04e-8997-4b4f-9ab6-7277a0942d54.png"><img width="134" alt="Screenshot 2023-03-23 at 14 12 06" src="https://user-images.githubusercontent.com/13063165/227214901-9c1bf04e-8997-4b4f-9ab6-7277a0942d54.png" style="max-width: 100%;"></a></p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.35.1]</li>
<li>Operating System: [Windows 10]</li>
<li>Browser: [Chromium]</li>
</ul>
<h3 dir="auto">Source code</h3>
<p dir="auto">I am using playwright with javascript. In my framework I am passing the page instance to a method (lets call it frameHandler()) which is outside test method. In frameHandler() method when I am trying to perform keyboard press event I am getting an error saying TypeError: Cannot read properties of undefined (reading 'press')</p>
<p dir="auto"><strong>Below is the source code</strong></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/65117374/250604165-fa5efb15-e018-46d5-8dcf-720bcc9f6820.png"><img src="https://user-images.githubusercontent.com/65117374/250604165-fa5efb15-e018-46d5-8dcf-720bcc9f6820.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/65117374/250602516-1612ae41-e765-4201-8ae5-2b867379078f.png"><img src="https://user-images.githubusercontent.com/65117374/250602516-1612ae41-e765-4201-8ae5-2b867379078f.png" alt="image" style="max-width: 100%;"></a></p>