<p dir="auto">How I can just check URL in new tab opened after link clicking, and at once abort all traffic to avoid not needed network traffic generation.<br>
I tried with below test but it is not working.</p>



<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.34]</li>
<li>Operating System: [Windows 11]</li>
<li>Browser: [Chromium]</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.<br>
Using default config</li>
</ul>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { expect, test } from '@playwright/test';

test('verify link in new tab', async ({ page }) =&gt; {
    await page.goto('https://playwright.dev/');
    const popupPromise = page.waitForEvent('popup');

    await page.getByRole('link', { name: 'GitHub repository' }).click();
    const popup = await popupPromise;
    
     //synchronous below - will not fully work
    await popup.route('**/*', (route) =&gt; route.abort());
    await popup.waitForLoadState();
    
    await expect(popup).toHaveURL('https://github.com/microsoft/playwright');
});"><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-en">test</span><span class="pl-kos">(</span><span class="pl-s">'verify link in new tab'</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://playwright.dev/'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">const</span> <span class="pl-s1">popupPromise</span> <span class="pl-c1">=</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">waitForEvent</span><span class="pl-kos">(</span><span class="pl-s">'popup'</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">'link'</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">'GitHub repository'</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">click</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">const</span> <span class="pl-s1">popup</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">popupPromise</span><span class="pl-kos">;</span>
    
     <span class="pl-c">//synchronous below - will not fully work</span>
    <span class="pl-k">await</span> <span class="pl-s1">popup</span><span class="pl-kos">.</span><span class="pl-en">route</span><span class="pl-kos">(</span><span class="pl-s">'**/*'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">route</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-s1">route</span><span class="pl-kos">.</span><span class="pl-en">abort</span><span class="pl-kos">(</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-s1">popup</span><span class="pl-kos">.</span><span class="pl-en">waitForLoadState</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">popup</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">toHaveURL</span><span class="pl-kos">(</span><span class="pl-s">'https://github.com/microsoft/playwright'</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>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: v1.32.2</li>
<li>Operating System: Windows 10</li>
<li>Browser: chromium, firefox, webkit</li>
<li>Other info: Node v16.14.0</li>
</ul>
<h3 dir="auto">Source code</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I provided exact source code that allows reproducing the issue locally.</li>
</ul>




<p dir="auto"><strong>package.json</strong></p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
    &quot;name&quot;: &quot;testcase&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;type&quot;: &quot;module&quot;,
    &quot;dependencies&quot;: {
        &quot;playwright&quot;: &quot;1.32.2&quot;
    }
}"><pre class="notranslate">{
    <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>testcase<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>1.0.0<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>module<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"dependencies"</span>: {
        <span class="pl-ent">"playwright"</span>: <span class="pl-s"><span class="pl-pds">"</span>1.32.2<span class="pl-pds">"</span></span>
    }
}</pre></div>
<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="// index.js
import playwright from &quot;playwright&quot;;

for (let i = 0; i &lt; 1000; ++i) {
    console.log(i);
    const browser = await playwright.chromium.launch({ slowMo: 250 });
    const context = await browser.newContext();
    const page = await context.newPage();
    page.on(&quot;framenavigated&quot;, async (frame) =&gt; {
        await frame.locator(&quot;span&quot;).evaluateAll(() =&gt; {});
        await frame.addStyleTag({ content: &quot;div {}&quot; });
    });
    await page.goto(&quot;https://playwright.dev/docs/api/class-browser&quot;);
    await context.close();
    await browser.close();
}"><pre class="notranslate"><span class="pl-c">// index.js</span>
<span class="pl-k">import</span> <span class="pl-s1">playwright</span> <span class="pl-k">from</span> <span class="pl-s">"playwright"</span><span class="pl-kos">;</span>

<span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-k">let</span> <span class="pl-s1">i</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">;</span> <span class="pl-s1">i</span> <span class="pl-c1">&lt;</span> <span class="pl-c1">1000</span><span class="pl-kos">;</span> <span class="pl-c1">++</span><span class="pl-s1">i</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-s1">i</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">const</span> <span class="pl-s1">browser</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">playwright</span><span class="pl-kos">.</span><span class="pl-c1">chromium</span><span class="pl-kos">.</span><span class="pl-en">launch</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">slowMo</span>: <span class="pl-c1">250</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">const</span> <span class="pl-s1">context</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>
    <span class="pl-k">const</span> <span class="pl-s1">page</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">newPage</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">"framenavigated"</span><span class="pl-kos">,</span> <span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-s1">frame</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">frame</span><span class="pl-kos">.</span><span class="pl-en">locator</span><span class="pl-kos">(</span><span class="pl-s">"span"</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">evaluateAll</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-kos">{</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-s1">frame</span><span class="pl-kos">.</span><span class="pl-en">addStyleTag</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">content</span>: <span class="pl-s">"div {}"</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>
    <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://playwright.dev/docs/api/class-browser"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-k">await</span> <span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">close</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-s1">browser</span><span class="pl-kos">.</span><span class="pl-en">close</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>Unzip <a href="https://github.com/microsoft/playwright/files/11157402/testcase.zip">testcase.zip</a></li>
<li><code class="notranslate">npm install</code></li>
<li><code class="notranslate">DEBUG=pw:api,pw:channel:command,pw:channel:response node index.js</code></li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">No error.</p>
<p dir="auto"><strong>Actual</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="0
  pw:api =&gt; browserType.launch started +0ms
  pw:channel:command {
  pw:channel:command   id: 1,
  pw:channel:command   guid: 'browser-type@217bc1acf01e8ab60147d89d2aafcd1a',
  pw:channel:command   method: 'launch',
  pw:channel:command   params: { ignoreAllDefaultArgs: false, slowMo: 250 }
  pw:channel:command } +0ms
  pw:channel:response {
  pw:channel:response   id: 1,
  pw:channel:response   result: { browser: { guid: 'browser@457c5f62717d2b86635a9c36c4b2a3a2' } }
  pw:channel:response } +0ms
  pw:api &lt;= browserType.launch succeeded +412ms
  pw:api =&gt; browser.newContext started +2ms
  pw:channel:command {
  pw:channel:command   id: 2,
  pw:channel:command   guid: 'browser@457c5f62717d2b86635a9c36c4b2a3a2',
  pw:channel:command   method: 'newContext',
  pw:channel:command   params: { noDefaultViewport: false }
  pw:channel:command } +413ms
  pw:channel:response {
  pw:channel:response   id: 2,
  pw:channel:response   result: {
  pw:channel:response     context: { guid: 'browser-context@c2725438de82db711cab1d84e6966c97' }
  pw:channel:response   }
  pw:channel:response } +11ms
  pw:api &lt;= browser.newContext succeeded +9ms
  pw:api =&gt; browserContext.newPage started +1ms
  pw:channel:command {
  pw:channel:command   id: 3,
  pw:channel:command   guid: 'browser-context@c2725438de82db711cab1d84e6966c97',
  pw:channel:command   method: 'newPage',
  pw:channel:command   params: undefined
  pw:channel:command } +10ms
  pw:channel:response {
  pw:channel:response   id: 3,
  pw:channel:response   result: { page: { guid: 'page@b84a8ba8e6e23aa2528953cbf97dc5c3' } }
  pw:channel:response } +155ms
  pw:api &lt;= browserContext.newPage succeeded +153ms
  pw:api =&gt; page.goto started +1ms
  pw:channel:command {
  pw:channel:command   id: 4,
  pw:channel:command   guid: 'frame@3ee5e10621a15eaf80cb985dbccb9a28',
  pw:channel:command   method: 'goto',
  pw:channel:command   params: {
  pw:channel:command     url: 'https://playwright.dev/docs/api/class-browser',
  pw:channel:command     waitUntil: 'load'
  pw:channel:command   }
  pw:channel:command } +154ms
  pw:api navigating to &quot;https://playwright.dev/docs/api/class-browser&quot;, waiting until &quot;load&quot; +2ms
  pw:api   &quot;commit&quot; event fired +45ms
  pw:api   navigated to &quot;https://playwright.dev/docs/api/class-browser&quot; +1ms
  pw:api =&gt; locator.evaluateAll started +3ms
  pw:channel:command {
  pw:channel:command   id: 5,
  pw:channel:command   guid: 'frame@3ee5e10621a15eaf80cb985dbccb9a28',
  pw:channel:command   method: 'evalOnSelectorAll',
  pw:channel:command   params: {
  pw:channel:command     selector: 'span',
  pw:channel:command     expression: '() =&gt; {}',
  pw:channel:command     isFunction: true,
  pw:channel:command     arg: { value: [Object], handles: [] }
  pw:channel:command   }
  pw:channel:command } +51ms
  pw:api   &quot;domcontentloaded&quot; event fired +189ms
  pw:api   &quot;load&quot; event fired +117ms
  pw:channel:response { id: 5, result: { value: { v: 'undefined' } } } +512ms
  pw:api &lt;= locator.evaluateAll succeeded +157ms
  pw:api =&gt; frame.addStyleTag started +3ms
  pw:channel:command {
  pw:channel:command   id: 6,
  pw:channel:command   guid: 'frame@3ee5e10621a15eaf80cb985dbccb9a28',
  pw:channel:command   method: 'addStyleTag',
  pw:channel:command   params: { content: 'div {}' }
  pw:channel:command } +466ms
  pw:channel:response {
  pw:channel:response   id: 4,
  pw:channel:response   result: { response: { guid: 'response@cab1b2a18575669f02a3fbe57676ad7a' } }
  pw:channel:response } +105ms
  pw:api &lt;= page.goto succeeded +100ms
  pw:api =&gt; browserContext.close started +3ms
  pw:channel:command {
  pw:channel:command   id: 7,
  pw:channel:command   guid: 'browser-context@c2725438de82db711cab1d84e6966c97',
  pw:channel:command   method: 'close',
  pw:channel:command   params: undefined
  pw:channel:command } +103ms
  pw:channel:response { id: 7 } +12ms
  pw:api &lt;= browserContext.close succeeded +8ms
  pw:api =&gt; browser.close started +1ms
  pw:channel:command {
  pw:channel:command   id: 8,
  pw:channel:command   guid: 'browser@457c5f62717d2b86635a9c36c4b2a3a2',
  pw:channel:command   method: 'close',
  pw:channel:command   params: undefined
  pw:channel:command } +9ms
  pw:channel:response { id: 8 } +38ms
  pw:api &lt;= browser.close succeeded +38ms
1
  pw:api =&gt; browserType.launch started +3ms
  pw:channel:command {
  pw:channel:command   id: 9,
  pw:channel:command   guid: 'browser-type@217bc1acf01e8ab60147d89d2aafcd1a',
  pw:channel:command   method: 'launch',
  pw:channel:command   params: { ignoreAllDefaultArgs: false, slowMo: 250 }
  pw:channel:command } +42ms
  pw:channel:response {
  pw:channel:response   id: 6,
  pw:channel:response   result: { element: { guid: 'handle@7833e65f500bd1d978e1450a5459c7bb' } }
  pw:channel:response } +238ms
C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\client\connection.js:211
      if (!object) throw new Error(`Object with guid ${arg.guid} was not bound in the connection`);
                   ^

Error: Object with guid handle@7833e65f500bd1d978e1450a5459c7bb was not bound in the connection
    at Connection._tChannelImplFromWire (C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\client\connection.js:211:26)
    at C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\protocol\validatorPrimitives.js:129:20
    at C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\protocol\validatorPrimitives.js:108:21
    at Connection.dispatch (C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\client\connection.js:170:26)
    at Immediate.&lt;anonymous&gt; (C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\inProcessFactory.js:46:83)
    at processImmediate (node:internal/timers:466:21)"><pre class="notranslate"><code class="notranslate">0
  pw:api =&gt; browserType.launch started +0ms
  pw:channel:command {
  pw:channel:command   id: 1,
  pw:channel:command   guid: 'browser-type@217bc1acf01e8ab60147d89d2aafcd1a',
  pw:channel:command   method: 'launch',
  pw:channel:command   params: { ignoreAllDefaultArgs: false, slowMo: 250 }
  pw:channel:command } +0ms
  pw:channel:response {
  pw:channel:response   id: 1,
  pw:channel:response   result: { browser: { guid: 'browser@457c5f62717d2b86635a9c36c4b2a3a2' } }
  pw:channel:response } +0ms
  pw:api &lt;= browserType.launch succeeded +412ms
  pw:api =&gt; browser.newContext started +2ms
  pw:channel:command {
  pw:channel:command   id: 2,
  pw:channel:command   guid: 'browser@457c5f62717d2b86635a9c36c4b2a3a2',
  pw:channel:command   method: 'newContext',
  pw:channel:command   params: { noDefaultViewport: false }
  pw:channel:command } +413ms
  pw:channel:response {
  pw:channel:response   id: 2,
  pw:channel:response   result: {
  pw:channel:response     context: { guid: 'browser-context@c2725438de82db711cab1d84e6966c97' }
  pw:channel:response   }
  pw:channel:response } +11ms
  pw:api &lt;= browser.newContext succeeded +9ms
  pw:api =&gt; browserContext.newPage started +1ms
  pw:channel:command {
  pw:channel:command   id: 3,
  pw:channel:command   guid: 'browser-context@c2725438de82db711cab1d84e6966c97',
  pw:channel:command   method: 'newPage',
  pw:channel:command   params: undefined
  pw:channel:command } +10ms
  pw:channel:response {
  pw:channel:response   id: 3,
  pw:channel:response   result: { page: { guid: 'page@b84a8ba8e6e23aa2528953cbf97dc5c3' } }
  pw:channel:response } +155ms
  pw:api &lt;= browserContext.newPage succeeded +153ms
  pw:api =&gt; page.goto started +1ms
  pw:channel:command {
  pw:channel:command   id: 4,
  pw:channel:command   guid: 'frame@3ee5e10621a15eaf80cb985dbccb9a28',
  pw:channel:command   method: 'goto',
  pw:channel:command   params: {
  pw:channel:command     url: 'https://playwright.dev/docs/api/class-browser',
  pw:channel:command     waitUntil: 'load'
  pw:channel:command   }
  pw:channel:command } +154ms
  pw:api navigating to "https://playwright.dev/docs/api/class-browser", waiting until "load" +2ms
  pw:api   "commit" event fired +45ms
  pw:api   navigated to "https://playwright.dev/docs/api/class-browser" +1ms
  pw:api =&gt; locator.evaluateAll started +3ms
  pw:channel:command {
  pw:channel:command   id: 5,
  pw:channel:command   guid: 'frame@3ee5e10621a15eaf80cb985dbccb9a28',
  pw:channel:command   method: 'evalOnSelectorAll',
  pw:channel:command   params: {
  pw:channel:command     selector: 'span',
  pw:channel:command     expression: '() =&gt; {}',
  pw:channel:command     isFunction: true,
  pw:channel:command     arg: { value: [Object], handles: [] }
  pw:channel:command   }
  pw:channel:command } +51ms
  pw:api   "domcontentloaded" event fired +189ms
  pw:api   "load" event fired +117ms
  pw:channel:response { id: 5, result: { value: { v: 'undefined' } } } +512ms
  pw:api &lt;= locator.evaluateAll succeeded +157ms
  pw:api =&gt; frame.addStyleTag started +3ms
  pw:channel:command {
  pw:channel:command   id: 6,
  pw:channel:command   guid: 'frame@3ee5e10621a15eaf80cb985dbccb9a28',
  pw:channel:command   method: 'addStyleTag',
  pw:channel:command   params: { content: 'div {}' }
  pw:channel:command } +466ms
  pw:channel:response {
  pw:channel:response   id: 4,
  pw:channel:response   result: { response: { guid: 'response@cab1b2a18575669f02a3fbe57676ad7a' } }
  pw:channel:response } +105ms
  pw:api &lt;= page.goto succeeded +100ms
  pw:api =&gt; browserContext.close started +3ms
  pw:channel:command {
  pw:channel:command   id: 7,
  pw:channel:command   guid: 'browser-context@c2725438de82db711cab1d84e6966c97',
  pw:channel:command   method: 'close',
  pw:channel:command   params: undefined
  pw:channel:command } +103ms
  pw:channel:response { id: 7 } +12ms
  pw:api &lt;= browserContext.close succeeded +8ms
  pw:api =&gt; browser.close started +1ms
  pw:channel:command {
  pw:channel:command   id: 8,
  pw:channel:command   guid: 'browser@457c5f62717d2b86635a9c36c4b2a3a2',
  pw:channel:command   method: 'close',
  pw:channel:command   params: undefined
  pw:channel:command } +9ms
  pw:channel:response { id: 8 } +38ms
  pw:api &lt;= browser.close succeeded +38ms
1
  pw:api =&gt; browserType.launch started +3ms
  pw:channel:command {
  pw:channel:command   id: 9,
  pw:channel:command   guid: 'browser-type@217bc1acf01e8ab60147d89d2aafcd1a',
  pw:channel:command   method: 'launch',
  pw:channel:command   params: { ignoreAllDefaultArgs: false, slowMo: 250 }
  pw:channel:command } +42ms
  pw:channel:response {
  pw:channel:response   id: 6,
  pw:channel:response   result: { element: { guid: 'handle@7833e65f500bd1d978e1450a5459c7bb' } }
  pw:channel:response } +238ms
C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\client\connection.js:211
      if (!object) throw new Error(`Object with guid ${arg.guid} was not bound in the connection`);
                   ^

Error: Object with guid handle@7833e65f500bd1d978e1450a5459c7bb was not bound in the connection
    at Connection._tChannelImplFromWire (C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\client\connection.js:211:26)
    at C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\protocol\validatorPrimitives.js:129:20
    at C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\protocol\validatorPrimitives.js:108:21
    at Connection.dispatch (C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\client\connection.js:170:26)
    at Immediate.&lt;anonymous&gt; (C:\Users\regseb\dev\testcase\node_modules\playwright-core\lib\inProcessFactory.js:46:83)
    at processImmediate (node:internal/timers:466:21)
</code></pre></div>
<h3 dir="auto">Additional info</h3>
<ul dir="auto">
<li>I add style with <code class="notranslate">frame.addStyleTag()</code>.
<ul dir="auto">
<li>Playwright sends a command to the browser to add style (using a protocol close to <a href="https://www.jsonrpc.org/specification" rel="nofollow">JSON-RPC</a>).
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  id: 6,
  guid: 'frame@3ee5e10621a15eaf80cb985dbccb9a28',
  method: 'addStyleTag',
  params: { content: 'div {}' }
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-c1">id</span>: <span class="pl-c1">6</span><span class="pl-kos">,</span>
  <span class="pl-c1">guid</span>: <span class="pl-s">'frame@3ee5e10621a15eaf80cb985dbccb9a28'</span><span class="pl-kos">,</span>
  <span class="pl-c1">method</span>: <span class="pl-s">'addStyleTag'</span><span class="pl-kos">,</span>
  <span class="pl-c1">params</span>: <span class="pl-kos">{</span> <span class="pl-c1">content</span>: <span class="pl-s">'div {}'</span> <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
</li>
</ul>
</li>
<li>I close the browser.
<ul dir="auto">
<li>Playwright <em>removes</em> the callbacks from the commands.</li>
</ul>
</li>
<li>Playwright receives the response from the command.
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  id: 6,
  result: { element: { guid: 'handle@7833e65f500bd1d978e1450a5459c7bb' } }
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-c1">id</span>: <span class="pl-c1">6</span><span class="pl-kos">,</span>
  <span class="pl-c1">result</span>: <span class="pl-kos">{</span> <span class="pl-c1">element</span>: <span class="pl-kos">{</span> <span class="pl-c1">guid</span>: <span class="pl-s">'handle@7833e65f500bd1d978e1450a5459c7bb'</span> <span class="pl-kos">}</span> <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<ul dir="auto">
<li>Playwright doesn't find the callback associated with the command and throws an exception.<br>
<div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/microsoft/playwright/blob/ecd0f927f4f0efb396aec1a839b4252b229f8ae0/packages/playwright-core/src/client/connection.ts#L191-L193">playwright/packages/playwright-core/src/client/connection.ts</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 191 to 193
      in
      <a data-pjax="true" class="commit-tease-sha" href="/microsoft/playwright/commit/ecd0f927f4f0efb396aec1a839b4252b229f8ae0">ecd0f92</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L191" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="191"></td>
          <td id="LC191" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">const</span> <span class="pl-s1">object</span> <span class="pl-c1">=</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">_objects</span><span class="pl-kos">.</span><span class="pl-en">get</span><span class="pl-kos">(</span><span class="pl-s1">arg</span><span class="pl-kos">.</span><span class="pl-c1">guid</span><span class="pl-kos">)</span><span class="pl-c1">!</span><span class="pl-kos">;</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L192" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="192"></td>
          <td id="LC192" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-c1">!</span><span class="pl-s1">object</span><span class="pl-kos">)</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L193" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="193"></td>
          <td id="LC193" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">   <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-smi">Error</span><span class="pl-kos">(</span><span class="pl-s">`Object with guid <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">arg</span><span class="pl-kos">.</span><span class="pl-c1">guid</span><span class="pl-kos">}</span></span> was not bound in the connection`</span><span class="pl-kos">)</span><span class="pl-kos">;</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
</li>
</ul>
</li>
</ul>
<h3 dir="auto">Related issues</h3>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1528711342" data-permission-text="Title is private" data-url="https://github.com/microsoft/playwright/issues/20023" data-hovercard-type="issue" data-hovercard-url="/microsoft/playwright/issues/20023/hovercard" href="https://github.com/microsoft/playwright/issues/20023">#20023</a></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1599996576" data-permission-text="Title is private" data-url="https://github.com/microsoft/playwright/issues/21210" data-hovercard-type="issue" data-hovercard-url="/microsoft/playwright/issues/21210/hovercard?comment_id=1477840641&amp;comment_type=issue_comment" href="https://github.com/microsoft/playwright/issues/21210#issuecomment-1477840641">#21210 (comment)</a></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1599996576" data-permission-text="Title is private" data-url="https://github.com/microsoft/playwright/issues/21210" data-hovercard-type="issue" data-hovercard-url="/microsoft/playwright/issues/21210/hovercard?comment_id=1506956035&amp;comment_type=issue_comment" href="https://github.com/microsoft/playwright/issues/21210#issuecomment-1506956035">#21210 (comment)</a></li>
</ul>