Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot upload video file in Chromium #20900

Closed
KamilMarek-IV opened this issue Feb 14, 2023 · 4 comments
Closed

[BUG] Cannot upload video file in Chromium #20900

KamilMarek-IV opened this issue Feb 14, 2023 · 4 comments

Comments

@KamilMarek-IV
Copy link

KamilMarek-IV commented Feb 14, 2023

Context:

  • Playwright Version: 1.30.0 C# nuget
  • Operating System: Windows
  • Browser: Chromium
  • Extra: NUnit

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:

// option 1
var inputLocator= Page.Locator(".ant-upload-drag").Locator("input[type=\"file\"]");

await inputLocator.SetInputFilesAsync(new[] { @"C:\temp\video.mp4" });

// option 2
var fileChooser = await Page.RunAndWaitForFileChooserAsync(async () =>
{
   await Page.Locator(".ant-upload-drag").ClickAsync();
}, new() { Timeout = 15000 });
await fileChooser.SetFilesAsync(@"C:\temp\video.mp4");
  
  // Please include a snippet of HTML that shows an example of the content
  // you are testing.
// we have react app using ant-design - upload is a simple input which accepts video files
<div class="ant-upload ant-upload-drag css-eylmcn">
<span tabindex="0" class="ant-upload ant-upload-btn" role="button">
<input type="file" accept=".MP4,.MOV,.MKV,.OGG,.OGV,.WEBM" style="display: none;">
<div class="ant-upload-drag-container">
<p class="ant-upload-drag-icon">
<span role="img" aria-label="upload" class="anticon anticon-upload">
</span>
</p>
<p class="ant-upload-text">Upload an introduction video to your profile</p>
<p class="ant-upload-hint">You can upload one video by drag and drop here</p>
<p>Or click to choose files</p></div></span></div>

Describe the bug

File is sent to input, but it's displayed as not valid video file, preview is not working and file cannot be uploaded

image

It also does not work when execution is paused and I upload file manually => seems problem with playwright browser.
Works fine on 'normal' chrome.

Also works fine when run on Firefox

<RunSettings>
  <Playwright>
    <BrowserName>firefox</BrowserName>
  </Playwright>
</RunSettings>
@KamilMarek-IV KamilMarek-IV changed the title [BUG] Cannot upload video file [BUG] Cannot upload video file in Chromium Feb 14, 2023
@KamilMarek-IV
Copy link
Author

Seems similar/related to #4585 but 4585 is fixed

@aslushnikov
Copy link
Collaborator

@KamilMarek-IV it looks like Chromium doesn't ship codecs necessary for your video. You should use a stable Google Chrome channel instead; read more in our documentation: https://playwright.dev/docs/next/browsers#when-to-use-google-chrome--microsoft-edge-and-when-not-to

@KamilMarek-IV
Copy link
Author

thanks a lot, adding chrome to .runsettings helped

@yekayee
Copy link

yekayee commented Oct 9, 2023

can u give example code? icant upload video on twitter

thanks a lot, adding chrome to .runsettings helped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants