<p dir="auto"><strong>Context:</strong></p>
<ul dir="auto">
<li>Playwright Version: [1.10.0]</li>
<li>Operating System: [Linux]</li>
<li>Node.js version: [14.10.0]</li>
<li>Browser: [Chromium]</li>
<li>Extra: []</li>
</ul>


<p dir="auto"><strong>Code Snippet</strong></p>
<p dir="auto">Generate a 400M large file</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="dd if=/dev/zero of=/tmp/400M bs=1M count=400"><pre class="notranslate">dd if=/dev/zero of=/tmp/400M bs=1M count=400</pre></div>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const { chromium } = require(&quot;playwright&quot;);


const dataPath='/tmp/400M';

(async () =&gt; {
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.setContent(
    '&lt;input type=&quot;file&quot; name=&quot;fileToUpload&quot; id=&quot;fileToUpload&quot;&gt;'
  );
  await page.setInputFiles(&quot;input&quot;, dataPath);

  await browser.close();
})();"><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-k">const</span> <span class="pl-s1">dataPath</span><span class="pl-c1">=</span><span class="pl-s">'/tmp/400M'</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">browser</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">launch</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">browser</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">page</span><span class="pl-kos">.</span><span class="pl-en">setContent</span><span class="pl-kos">(</span>
    <span class="pl-s">'&lt;input type="file" name="fileToUpload" id="fileToUpload"&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">setInputFiles</span><span class="pl-kos">(</span><span class="pl-s">"input"</span><span class="pl-kos">,</span> <span class="pl-s1">dataPath</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><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><br>
Can't upload a large file(about 400MB).</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
  pw:api =&gt; browserType.launch started +0ms
  pw:api &lt;= browserType.launch succeeded +85ms
  pw:api =&gt; browser.newContext started +0ms
  pw:api &lt;= browser.newContext succeeded +3ms
  pw:api =&gt; browserContext.newPage started +0ms
  pw:api &lt;= browserContext.newPage succeeded +20ms
  pw:api =&gt; page.setContent started +1ms
  pw:api setting frame content, waiting until &quot;load&quot; +1ms
  pw:api   navigated to &quot;about:blank&quot; +4ms
  pw:api &lt;= page.setContent succeeded +13ms
  pw:api =&gt; page.setInputFiles started +0ms
  pw:api &lt;= page.setInputFiles failed +1s
(node:25801) UnhandledPromiseRejectionWarning: Error: page.setInputFiles: Cannot create a string longer than 0x1fffffe8 characters
    at Object.slice (buffer.js:653:37)
    at Buffer.toString (buffer.js:801:14)
    at /home/king/Desktop/wifi/node_modules/playwright/lib/client/elementHandle.js:280:77
    at async Promise.all (index 0)
    at async Object.convertInputFiles (/home/king/Desktop/wifi/node_modules/playwright/lib/client/elementHandle.js:275:26)
    at async /home/king/Desktop/wifi/node_modules/playwright/lib/client/frame.js:366:60
    at async Frame._wrapApiCall (/home/king/Desktop/wifi/node_modules/playwright/lib/client/channelOwner.js:77:28)
    at async /home/king/Desktop/wifi/index2.js:12:3
(Use `node --trace-warnings ...` to show where the warning was created)
(node:25801) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25801) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
"><pre class="notranslate">  pw:api =<span class="pl-k">&gt;</span> browserType.launch started +0ms
  pw:api <span class="pl-k">&lt;</span>= browserType.launch succeeded +85ms
  pw:api =<span class="pl-k">&gt;</span> browser.newContext started +0ms
  pw:api <span class="pl-k">&lt;</span>= browser.newContext succeeded +3ms
  pw:api =<span class="pl-k">&gt;</span> browserContext.newPage started +0ms
  pw:api <span class="pl-k">&lt;</span>= browserContext.newPage succeeded +20ms
  pw:api =<span class="pl-k">&gt;</span> page.setContent started +1ms
  pw:api setting frame content, waiting <span class="pl-k">until</span> <span class="pl-s"><span class="pl-pds">"</span>load<span class="pl-pds">"</span></span> +1ms
  pw:api   navigated to <span class="pl-s"><span class="pl-pds">"</span>about:blank<span class="pl-pds">"</span></span> +4ms
  pw:api <span class="pl-k">&lt;</span>= page.setContent succeeded +13ms
  pw:api =<span class="pl-k">&gt;</span> page.setInputFiles started +0ms
  pw:api <span class="pl-k">&lt;</span>= page.setInputFiles failed +1s
(node:25801) UnhandledPromiseRejectionWarning: Error: page.setInputFiles: Cannot create a string longer than 0x1fffffe8 characters
    at Object.slice (buffer.js:653:37)
    at Buffer.toString (buffer.js:801:14)
    at /home/king/Desktop/wifi/node_modules/playwright/lib/client/elementHandle.js:280:77
    at async Promise.all (index 0)
    at async Object.convertInputFiles (/home/king/Desktop/wifi/node_modules/playwright/lib/client/elementHandle.js:275:26)
    at async /home/king/Desktop/wifi/node_modules/playwright/lib/client/frame.js:366:60
    at async Frame._wrapApiCall (/home/king/Desktop/wifi/node_modules/playwright/lib/client/channelOwner.js:77:28)
    at async /home/king/Desktop/wifi/index2.js:12:3
(Use <span class="pl-s"><span class="pl-pds">`</span>node --trace-warnings ...<span class="pl-pds">`</span></span> to show where the warning was created)
(node:25801) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async <span class="pl-k">function</span> <span class="pl-en">without</span> a catch block, or by rejecting a promise which was not handled with <span class="pl-en">.catch</span>(). To terminate the node process on unhandled promise rejection, use the CLI flag <span class="pl-s"><span class="pl-pds">`</span>--unhandled-rejections=strict<span class="pl-pds">`</span></span> (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25801) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero <span class="pl-c1">exit</span> code.
</pre></div>
<p dir="auto"><strong>Context:</strong></p>
<ul dir="auto">
<li>Playwright Version: 1.3.0</li>
<li>Operating System: Windows</li>
<li>Node.js version: 12.18.3</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 browser = await chromium.launch();
  const page = await browser.newPage();
  await page.setContent(
    '&lt;input type=&quot;file&quot; name=&quot;fileToUpload&quot; id=&quot;fileToUpload&quot;&gt;'
  );
  await page.setInputFiles(&quot;input&quot;, &quot;path/to/large/file.txt&quot;);
  await browser.close();
})();
"><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">browser</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">launch</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">browser</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">page</span><span class="pl-kos">.</span><span class="pl-en">setContent</span><span class="pl-kos">(</span>
    <span class="pl-s">'&lt;input type="file" name="fileToUpload" id="fileToUpload"&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">setInputFiles</span><span class="pl-kos">(</span><span class="pl-s">"input"</span><span class="pl-kos">,</span> <span class="pl-s">"path/to/large/file.txt"</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><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><br>
When uploading large file, about 100MB, <code class="notranslate">page.setInputFiles</code> fails. With Firefox and Webkit it takes some time but it works.<br>
Log:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  pw:api =&gt; page.setContent started +0ms
  pw:api setting frame content, waiting until &quot;load&quot; [] +1ms
  pw:api &lt;= page.setContent succeeded +79ms
  pw:api =&gt; page.setInputFiles started +2ms
  pw:api waiting for selector &quot;input&quot; [] +1ms
  pw:api   selector resolved to visible &lt;input type=&quot;file&quot; id=&quot;fileToUpload&quot; name=&quot;fileToUpload&quot;/&gt; [] +26ms
  pw:api &lt;= page.setInputFiles failed +1s
(node:19668) UnhandledPromiseRejectionWarning: page.setInputFiles: Protocol error (Runtime.callFunctionOn): Target closed.
=========================== logs ===========================
[api] waiting for selector &quot;input&quot;
[api]   selector resolved to visible &lt;input type=&quot;file&quot; id=&quot;fileToUpload&quot; name=&quot;fileToUpload&quot;/&gt;
============================================================
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.Error
    at C:\dev\playwright\node_modules\playwright\lib\chromium\crConnection.js:131:63
    at new Promise (&lt;anonymous&gt;)
    at CRSession.send (C:\dev\playwright\node_modules\playwright\lib\chromium\crConnection.js:130:16)
    at CRSession.send (C:\dev\playwright\node_modules\playwright\lib\helper.js:80:31)
    at CRExecutionContext.evaluateWithArguments (C:\dev\playwright\node_modules\playwright\lib\chromium\crExecutionContext.js:40:79)
    at evaluateExpression (C:\dev\playwright\node_modules\playwright\lib\javascript.js:164:40)
    at async FrameManager.waitForSignalsCreatedBy (C:\dev\playwright\node_modules\playwright\lib\frames.js:90:24)
    at async FrameExecutionContext.evaluateInternal (C:\dev\playwright\node_modules\playwright\lib\dom.js:36:16)
    at async CRPage.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\chromium\crPage.js:210:9)
    at async C:\dev\playwright\node_modules\playwright\lib\dom.js:440:13
  -- ASYNC --
    at CRSession.send (C:\dev\playwright\node_modules\playwright\lib\helper.js:79:23)
    at CRExecutionContext.evaluateWithArguments (C:\dev\playwright\node_modules\playwright\lib\chromium\crExecutionContext.js:40:79)
    at evaluateExpression (C:\dev\playwright\node_modules\playwright\lib\javascript.js:164:40)
    at async FrameManager.waitForSignalsCreatedBy (C:\dev\playwright\node_modules\playwright\lib\frames.js:90:24)
    at async FrameExecutionContext.evaluateInternal (C:\dev\playwright\node_modules\playwright\lib\dom.js:36:16)
    at async CRPage.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\chromium\crPage.js:210:9)
    at async C:\dev\playwright\node_modules\playwright\lib\dom.js:440:13
    at async FrameManager.waitForSignalsCreatedBy (C:\dev\playwright\node_modules\playwright\lib\frames.js:90:24)
    at async ElementHandle._setInputFiles (C:\dev\playwright\node_modules\playwright\lib\dom.js:438:9)
    at async C:\dev\playwright\node_modules\playwright\lib\frames.js:674:32
  -- ASYNC --
    at Frame.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\helper.js:79:23)
    at C:\dev\playwright\node_modules\playwright\lib\page.js:407:61
    at Page._attributeToPage (C:\dev\playwright\node_modules\playwright\lib\page.js:370:20)
    at Page.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\page.js:407:21)
    at Page.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\helper.js:80:31)
    at C:\dev\playwright\upload.js:9:14
(node:19668) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:19668) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code."><pre class="notranslate"><code class="notranslate">  pw:api =&gt; page.setContent started +0ms
  pw:api setting frame content, waiting until "load" [] +1ms
  pw:api &lt;= page.setContent succeeded +79ms
  pw:api =&gt; page.setInputFiles started +2ms
  pw:api waiting for selector "input" [] +1ms
  pw:api   selector resolved to visible &lt;input type="file" id="fileToUpload" name="fileToUpload"/&gt; [] +26ms
  pw:api &lt;= page.setInputFiles failed +1s
(node:19668) UnhandledPromiseRejectionWarning: page.setInputFiles: Protocol error (Runtime.callFunctionOn): Target closed.
=========================== logs ===========================
[api] waiting for selector "input"
[api]   selector resolved to visible &lt;input type="file" id="fileToUpload" name="fileToUpload"/&gt;
============================================================
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.Error
    at C:\dev\playwright\node_modules\playwright\lib\chromium\crConnection.js:131:63
    at new Promise (&lt;anonymous&gt;)
    at CRSession.send (C:\dev\playwright\node_modules\playwright\lib\chromium\crConnection.js:130:16)
    at CRSession.send (C:\dev\playwright\node_modules\playwright\lib\helper.js:80:31)
    at CRExecutionContext.evaluateWithArguments (C:\dev\playwright\node_modules\playwright\lib\chromium\crExecutionContext.js:40:79)
    at evaluateExpression (C:\dev\playwright\node_modules\playwright\lib\javascript.js:164:40)
    at async FrameManager.waitForSignalsCreatedBy (C:\dev\playwright\node_modules\playwright\lib\frames.js:90:24)
    at async FrameExecutionContext.evaluateInternal (C:\dev\playwright\node_modules\playwright\lib\dom.js:36:16)
    at async CRPage.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\chromium\crPage.js:210:9)
    at async C:\dev\playwright\node_modules\playwright\lib\dom.js:440:13
  -- ASYNC --
    at CRSession.send (C:\dev\playwright\node_modules\playwright\lib\helper.js:79:23)
    at CRExecutionContext.evaluateWithArguments (C:\dev\playwright\node_modules\playwright\lib\chromium\crExecutionContext.js:40:79)
    at evaluateExpression (C:\dev\playwright\node_modules\playwright\lib\javascript.js:164:40)
    at async FrameManager.waitForSignalsCreatedBy (C:\dev\playwright\node_modules\playwright\lib\frames.js:90:24)
    at async FrameExecutionContext.evaluateInternal (C:\dev\playwright\node_modules\playwright\lib\dom.js:36:16)
    at async CRPage.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\chromium\crPage.js:210:9)
    at async C:\dev\playwright\node_modules\playwright\lib\dom.js:440:13
    at async FrameManager.waitForSignalsCreatedBy (C:\dev\playwright\node_modules\playwright\lib\frames.js:90:24)
    at async ElementHandle._setInputFiles (C:\dev\playwright\node_modules\playwright\lib\dom.js:438:9)
    at async C:\dev\playwright\node_modules\playwright\lib\frames.js:674:32
  -- ASYNC --
    at Frame.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\helper.js:79:23)
    at C:\dev\playwright\node_modules\playwright\lib\page.js:407:61
    at Page._attributeToPage (C:\dev\playwright\node_modules\playwright\lib\page.js:370:20)
    at Page.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\page.js:407:21)
    at Page.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\helper.js:80:31)
    at C:\dev\playwright\upload.js:9:14
(node:19668) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:19668) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
</code></pre></div>