For many applications, testing PDFs is an important step in validating end-to-end user journeys. In mabl, you can automate the validation of PDF files and their contents, including capturing screenshots and detecting visual changes.
Testing a PDF in the Trainer
Testing PDFs in the mabl Trainer
With the record button on, click on the link or button that opens the PDF.
For embedded PDFs, the Trainer opens the PDF in the same tab. The Trainer supports PDFs embedded <embed>
or <object>
tags.
For downloaded PDFs, the Trainer shows a prompt asking whether you'd like to test the contents of the PDF. Click Yes to open the PDF in the mabl PDF viewer.
Chrome PDF viewer
If the PDF opens in the default Chrome PDF viewer, click on the download button. Downloading the PDF prompts the Trainer to open the PDF in the mabl PDF Viewer.
PDF download assertion
When you open a PDF in the mabl PDF viewer, the Trainer automatically adds a download assertion . By default, the step asserts the name of the PDF file. If your application creates a dynamically generated filename for the PDF every time it's downloaded, see our advice for working with dynamically generated filenames .
A PDF download assertion
Testing in the mabl PDF viewer
After downloading the PDF, you can test its contents in the "mabl PDF viewer." The Trainer automatically detects that you've switched to the mabl PDF viewer and adds a switch context step before the recorded steps.
PDF testing limitations
Keep in mind the following limitations for PDF testing:
Not supported for tests that run on Safari (WebKit)
PDFs that are generated via an HTTP POST request are only supported when encoded as x-www-form-urlencoded
.
Due to restrictions in Chrome, blob URL PDFs can be trained against when embedded or downloaded, but not when the blob URL is directly opened and the address bar starts with blob://
The Trainer cannot make assertions against documents that are solely images, such as scans.
There is no support for filling out PDF forms.