<p dir="auto"><strong>Context:</strong></p>
<ul dir="auto">
<li>Playwright Version: ^1.16.0-next-alpha-oct-7-2021</li>
<li>Operating System: Linux</li>
<li>Node.js version: v12.20.0</li>
<li>Browser: Firefox</li>
</ul>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const options = {
    acceptDownloads: true,
    headless : false,    
}
async function start(){
    const browser = await firefox.launchPersistentContext(&quot;/tmp/firefox&quot;, options);
    const page = browser.pages()[0]  
    page.on('download', download =&gt; {
        download.path().then(&quot;DOWNLOAD DONE&quot;, console.log) //never shows up
    });
}
start().catch((e)=&gt;{
    console.log(e)
})"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">options</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">acceptDownloads</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">headless</span> : <span class="pl-c1">false</span><span class="pl-kos">,</span>    
<span class="pl-kos">}</span>
<span class="pl-k">async</span> <span class="pl-k">function</span> <span class="pl-en">start</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">browser</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">firefox</span><span class="pl-kos">.</span><span class="pl-en">launchPersistentContext</span><span class="pl-kos">(</span><span class="pl-s">"/tmp/firefox"</span><span class="pl-kos">,</span> <span class="pl-s1">options</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-s1">browser</span><span class="pl-kos">.</span><span class="pl-en">pages</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">[</span><span class="pl-c1">0</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">'download'</span><span class="pl-kos">,</span> <span class="pl-s1">download</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-s1">download</span><span class="pl-kos">.</span><span class="pl-en">path</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">then</span><span class="pl-kos">(</span><span class="pl-s">"DOWNLOAD DONE"</span><span class="pl-kos">,</span> <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-c1">log</span><span class="pl-kos">)</span> <span class="pl-c">//never shows up</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">start</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">catch</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">e</span><span class="pl-kos">)</span><span class="pl-c1">=&gt;</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">e</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">The bug:</p>
<p dir="auto">I'm using a simple example with headless:false and trying to download a file in a random website, but the function "download.path()" never resolves the promise, which should return the file path. The code is working with "launch" function.</p>
<p dir="auto"><strong>Context:</strong></p>
<ul dir="auto">
<li>Playwright Version: 1.2.1</li>
<li>Operating System: Mac</li>
<li>Node version: 14.5</li>
<li>Browser: Chromium</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 { chromium } = require(&quot;playwright&quot;);

(async () =&gt; {
  const context = await chromium.launchPersistentContext(&quot;./udd&quot;, {
    headless: false,
    acceptDownloads: true,
    downloadsPath: &quot;./&quot;,
  });
  context.on(&quot;page&quot;, (page) =&gt; {
    page.on(&quot;download&quot;, (download) =&gt; {
      console.log(&quot;download&quot;, download);
    });
  });

  const newPage = await context.newPage();
  await newPage.goto(
    &quot;https://support.spatialkey.com/spatialkey-sample-csv-data&quot;
  );
  newPage.on(&quot;download&quot;, (download) =&gt; download.path().then(console.log));
})();"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-kos">{</span> chromium <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">"playwright"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-kos">(</span><span class="pl-k">async</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-k">const</span> <span class="pl-s1">context</span> <span class="pl-c1">=</span> <span class="pl-k">await</span> <span class="pl-s1">chromium</span><span class="pl-kos">.</span><span class="pl-en">launchPersistentContext</span><span class="pl-kos">(</span><span class="pl-s">"./udd"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span>
    <span class="pl-c1">headless</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-c1">acceptDownloads</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-c1">downloadsPath</span>: <span class="pl-s">"./"</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-s1">context</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">"page"</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-c1">=&gt;</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">"download"</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">download</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</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">"download"</span><span class="pl-kos">,</span> <span class="pl-s1">download</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-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-k">const</span> <span class="pl-s1">newPage</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-k">await</span> <span class="pl-s1">newPage</span><span class="pl-kos">.</span><span class="pl-en">goto</span><span class="pl-kos">(</span>
    <span class="pl-s">"https://support.spatialkey.com/spatialkey-sample-csv-data"</span>
  <span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-s1">newPage</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">"download"</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">download</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-s1">download</span><span class="pl-kos">.</span><span class="pl-en">path</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">then</span><span class="pl-kos">(</span><span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-c1">log</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-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Describe the bug</strong></p>
<ul dir="auto">
<li>When the page loads, click on any of the download links</li>
</ul>
<p dir="auto">Expectation:</p>
<ul dir="auto">
<li>See the path of downloaded file as well as complete download object</li>
</ul>
<p dir="auto">Current behavior:</p>
<ul dir="auto">
<li>Most of the times I don't see any logs</li>
<li>At times I would see logs for <code class="notranslate">context</code> based listener</li>
<li>I never see the download path's promise being resolved. I think it might be because the download size is too small but I would expect it to keep working properly even for small files.</li>
</ul>
<p dir="auto">Is there something wrong with my machine? I tried quitting existing chrome installation and reinstalling all packages to no avail. Any suggestion would be helpful, thanks!</p>