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
Name | Type | Details |
---|---|---|
filepath | String | path to the generated pdf (.pdf suffix is required) relative to the execution directory |
options optional | PDFPrintOptions | Print PDF Options |
options.orientation optional | String | Orientation of PDF page |
options.scale optional | number | Scale of PDF page |
options.background optional | boolean | Include background of PDF page |
options.width optional | number | Width of PDF page |
options.height optional | number | Height of PDF page |
options.top optional | number | Top padding of PDF page |
options.bottom optional | number | Bottom padding of PDF page |
options.left optional | number | Left padding of PDF page |
options.right optional | number | Right padding of PDF page |
options.shrinkToFit optional | boolean | Shrink page to fit page |
options.pageRanges | Array[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');
});