Skip to content

[🚀 Feature]: Managed Downloads: Set "savefile.default_directory" in Chrome #12092

@ShadowLNC

Description

@ShadowLNC

Use Case

In our site, clicking a button triggers the print preview modal with a custom file to print. Because it's a separate file (generated/fetched on-the-fly), we can't just use regular mechanisms to print the webpage.

Using Chrome's flag for --kiosk-printing will automatically confirm the print modal (and it's defaulting to "Save as PDF" since there are no other printers in the container). However, this is downloaded to the directory specified by the savefile.default_directory preference (by default - more information below).

Request

Since we are using managed downloads, Selenium sets download.default_directory for us (I think this is the file). Could we also set savefile.default_directory to the same value please?

Additional Information

  • --kiosk-printing will not prompt to choose a directory when saving a PDF
  • I checked the value via cat /tmp/.org.chromium.Chromium.7wzSS0/Default/Preferences | jq '.savefile' in the Selenium Node (Chrome) container
    • I got the directory via chrome://profile-internals
  • There is no savefile key (jq shows null) when Chrome is first launched
  • Attempting to print (and thus save to PDF) will set it by default to /home/seluser/Downloads (which doesn't exist)
  • If the savefile.default_directory value doesn't exist, then no file will be saved
    • This is kind of a bug I guess?
  • If the user right-clicks and chooses "Save As" on a webpage or image, this will prompt for a directory, and update the value of savefile.default_directory if the page is saved (but not if the user cancels the dialogue box)
    • This is only when using VNC, we can't interact with the OS from Selenium

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-gridEverything grid and server relatedI-enhancementSomething could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions