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

File download and list API for Playwright #417

Open
vania-pooh opened this issue Apr 3, 2024 · 4 comments
Open

File download and list API for Playwright #417

vania-pooh opened this issue Apr 3, 2024 · 4 comments
Milestone

Comments

@vania-pooh
Copy link
Member

Need something similar to /download API in Selenium.

@facusantillo
Copy link

This is critical for us too, since we are moving to playwright from Selenium C# and we don't have a way to recover the files from the pod.

@keef78
Copy link

keef78 commented Jun 20, 2024

we need it as well, much needed to download files on playwright running on moon. download to f.e. /home/user/Downloads doesnt work (using robot framework with browser library (playwright)

@vania-pooh vania-pooh added this to the 2.7.1 milestone Jul 21, 2024
@vania-pooh
Copy link
Member Author

const { chromium } = require('playwright');
  
(async () => {
  var browser = await chromium.connect({ timeout: 0, wsEndpoint: 'ws://moon.aerokube.local/playwright/chrome/playwright-1.46.1?headless=false' });
  const page = await browser.newPage();
  await page.goto('https://kernel.org/');

  const downloadPromise = page.waitForEvent('download');
  await page.getByRole('link', { name: '6.10.8' }).click();
  const download = await downloadPromise;

  await download.saveAs(download.suggestedFilename());
  await browser.close();
})();

https://playwright.dev/docs/downloads

@vania-pooh vania-pooh changed the title File download and list API for Playwright, Cypress, Devtools File download and list API for Playwright Sep 6, 2024
@keef78
Copy link

keef78 commented Sep 6, 2024

I am not sure I understand the comment, basically our issue is not with the download it self - file is downloaded - but it cannot be recovered from the "save as" lcoation - the lcoation is not available to the current running browser session - so in the case for example you download the PDF file as per documentation to "/home/user/Downloads/some.pdf" - https://aerokube.com/moon/latest/#accessing-downloaded-files , the session started by playwright cannot reach this destination. I have verified the access rights are ok..

but when we try to serve the files in advance to the browser session https://aerokube.com/moon/latest/#selenium-context - so during the start of the session browser is informed where are some file fot the test usage, like in /home/user/some.pdf , the browser session in playwright on Moon can open this file ..

@vania-pooh vania-pooh modified the milestones: 2.7.2, 2.7.3 Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants