Due to browser specifications, clicking a PDF link may prioritize the preview display (PDF viewer), preventing the file from being downloaded. In this procedure, we will force a direct download by converting the step into Playwright code and simulating a click while holding the Alt key.
Procedure
Open the target scenario: Select the test scenario you want to edit.
Select the target step: Select the "Click Step" that clicks the PDF link.
Convert to Playwright code step: Select [Convert to Playwright Code Step] from the step menu.
Modify the code (Specify Alt key): Add
{ modifiers: ['Alt'] }to theclickmethod in the displayed code.// Before await page.getByRole("link", {name: "Document PDF"}).click(); // After (Specifying Alt key) await page.getByRole("link", {name: "Document PDF"}).click({ modifiers: ['Alt'] });(Optional) Add a wait step for download completion: Click actions in Playwright code complete very quickly. If the PDF file size is large or the network environment is slow, and the test ends (or proceeds to the next step) before the download is finished, add a "Wait Step" (e.g., about 5 to 10 seconds) immediately after the code step.
Save: Click [Save] at the top right of the screen.
Verification Method
Run the scenario and confirm the following behavior at the relevant step:
The PDF preview does not open in the browser.
The file is downloaded successfully.
If necessary, verify in the [Test Results] details that the step completed successfully.
Notes
Use of Browser Shortcuts: This procedure utilizes the standard browser shortcut where clicking a link while holding the Alt key saves the link target.
Criteria for Waiting: Normally, the process works without a wait step. Consider adding Step 5 only if you observe behavior suggesting the download hasn't finished (e.g., the browser closes before the file is saved).