Skip to main content

savePDF

Prints the page of the current browsing context to a PDF file on your OS.

Usage
browser.savePDF(filepath, { orientation, scale, background, width, height, top, bottom, left, right, shrinkToFit, pageRanges })
Parameters
NameTypeDetails
filepathStringpath to the generated pdf (.pdf suffix is required) relative to the execution directory
options
optional
PDFPrintOptionsPrint PDF Options
options.orientation
optional
StringOrientation of PDF page
options.scale
optional
numberScale of PDF page
options.background
optional
booleanInclude background of PDF page
options.width
optional
numberWidth of PDF page
options.height
optional
numberHeight of PDF page
options.top
optional
numberTop padding of PDF page
options.bottom
optional
numberBottom padding of PDF page
options.left
optional
numberLeft padding of PDF page
options.right
optional
numberRight padding of PDF page
options.shrinkToFit
optional
booleanShrink page to fit page
options.pageRangesArray[object]Range of pages to include in PDF
Example
savePDF.js
it('should save a PDF screenshot of the browser view', function () {
await browser.savePDF('./some/path/screenshot.pdf');
});