Closed
Description
Currently when I'm trying to connect browser over CDP, Playwright always uses temp folder:
| const artifactsDir = await fs.promises.mkdtemp(ARTIFACTS_FOLDER); |
| downloadsPath: artifactsDir, |
I wish to pass custom folder for downloadsPath in order to achieve access for downloaded files from Selenoid container.
This is available only if download path is equals to "/home/selenium/Downloads" (docs) which I can't set in Playwright right now.
Additionally, it would be nice if Playwright could store UUID of saved file, same as suggestedFilename property.
That would help to find a particular file via Selenoid API (docs)
Reacted by MGmotor
Metadata
Metadata
Assignees
Labels
No labels
Activity
pavelfeldman commentedon Dec 3, 2021
This is unlikely to be addressed because only the launcher of the browser has control over the download folder for security reason. Raise this against Selenoid and they can come to us for options.
tmarenko commentedon Dec 4, 2021
I'm not sure that I'm understanding correctly the security reason.
If I hardcode the path to:
then it works and downloads files as intended.
I've tried to pass
Browser.setDownloadBehaviorat launch and after launch with customdownloadPathbut seems Playwright always uses temp folder for downloads over CDP:playwright/packages/playwright-core/src/server/browser.ts
Line 84 in f802c27
I'm using Python's package of Playwright so I can't easily edit source code of the problem because it's on JS server side.
Any chances that feature could be done with new optional paramater or you still think that it's Selenoid's issue?
tmarenko commentedon Dec 6, 2021
I've made these example commits to show what I've meant:
tmarenko/playwright-python@0743e8e
tmarenko@297d4c6
With these kind of changes I can easily gain access to downloaded file:
tmarenko commentedon Dec 15, 2021
Pavel Feldman (@pavelfeldman)
sorry to bothering you but could you review my last two comments and reply what you think about it?
I'm really struggling to understand the security reason behind the Selenoid itself (if it has such).
tmarenko commentedon Mar 24, 2022
Pavel Feldman (@pavelfeldman)
any chances that you could review this again?
fix: Remove CDP download path workaround (unreliable)
fix(connectOverCDP): preserve browser-default downloads in the defaul…