Endtest

Endtest

›Web Tests

Web Tests

  • How to create Web Tests
  • Finding elements in Web Applications
  • How to execute Web Tests
  • Assertions for Web Tests
  • IF Statements for Web Tests
  • Web Applications with restricted access
  • How to test in iframes
  • How to test in multiple tabs
  • How to test File Uploads
  • How to test File Downloads
  • How to test Emails
  • How to test PDF files
  • How to test Chrome Extensions
  • Dealing with reCAPTCHA
  • Dealing with Dynamic Locators
  • Dealing with Canvas Elements
  • Performing a Drag and Drop
  • Execute JavaScript
  • Modify HTTP Headers
  • Testing WebRTC Applications
  • How to scroll in Web Tests
  • How to test Checkboxes
  • How to test Dropdowns
  • Dealing with Sessions
  • Web Crawler
  • Export Web Tests
  • Migrating from Selenium

Mobile Tests

  • How to create Mobile Tests
  • Finding elements in Mobile Applications
  • How to execute Mobile Tests
  • Assertions for Mobile Tests
  • IF Statements for Mobile Tests
  • How to scroll in Mobile Tests
  • Performing Complex Gestures

Advanced

  • Variables
  • Waits
  • Endtest API
  • Scheduler
  • Drive
  • Adding Collaborators
  • Computer Vision
  • Importing Test Cases
  • Using Loops
  • Data-driven Testing
  • Send API Requests
  • Read SMS
  • Execute SQL queries
  • Self-Healing Tests
  • Email Notifications
  • Slack Notifications
  • PagerDuty Notifications
  • Webhook Notifications
  • Automatic Backup
  • Advanced Settings
  • Multiple environments
  • How to stop a test
  • Utilities
  • Utilities API
  • Team
  • On-Premises

Integrations

  • Atlassian Jira
  • Slack
  • PagerDuty
  • Microsoft Teams
  • Discord
  • Mattermost
  • Jenkins
  • GitHub
  • Azure DevOps
  • GitLab
  • TeamCity
  • CircleCI
  • TravisCI
  • Bitbucket
  • Heroku
  • Bamboo Server
  • Test Case Management
  • SSO
  • BrowserStack
  • Sauce Labs

How to test PDF files

Introduction

Endtest provides several ways to work with PDF files during your automated tests, from extracting metadata, to analyzing content using AI, to converting PDFs into HTML for direct interaction.


Testing PDF metadata

After your test downloads a PDF file, you can extract metadata using the Set Variable action with these methods:

  • Extract Name of Most Recent Downloaded File
  • Extract Size of Most Recent Downloaded File
  • Extract MIME Type of Most Recent Downloaded File
  • Link to Most Recent Downloaded File

You can then use the resulting variables in later steps, such as: Add Assertion → Variable Assertion.


Opening the PDF in the browser

If your test downloads a PDF file, you can open it in the browser by inserting the variable from Set Variable → Link to Most Recent Downloaded File into a Go to URL step.

To open the PDF in a separate browser tab, use:

  • Miscellaneous → Open new tab

Place this step before the Go to URL step so the PDF opens in the newly created tab.

After opening it in a new tab, you can navigate between tabs using:

  • Miscellaneous → Switch to next tab
  • Miscellaneous → Switch to previous tab

Because a PDF is not composed of HTML elements, its internal content cannot be clicked or located directly. To interact with individual elements, convert the PDF into HTML (see below).


Testing PDF content

There are multiple approaches to validate PDF content, depending on your needs.


1. Extract Invoice Data from PDF using AI

You can extract structured invoice information using the extractInvoiceDataFromPDF action from the Endtest Utilities API.

This action uses AI with Deep Learning OCR and Document Understanding Models to detect fields such as:

  • invoice number
  • invoice date
  • vendor name
  • subtotal, tax, total
  • line items

Endtest converts the output into a simple, predictable JSON format.

You can extract values from this JSON using:

Miscellaneous → Utilities → Extract Value from JSON

Note: extractInvoiceDataFromPDF does not require opening the PDF in a browser.

Note: extractInvoiceDataFromPDF processes only the first page of a PDF. If your invoice spans multiple pages and you need to extract data from each of them, first split the PDF using the extractPageFromPDF action, then run extractInvoiceDataFromPDF on each extracted page separately.


2. Convert the PDF into an HTML file

You can convert any PDF into an HTML file using the convertPDFtoHTML action from the Endtest Utilities API.

This makes the PDF content interactive, allowing you to use standard Endtest actions such as:

  • Scroll
  • Click
  • Snipping Tool
  • Miscellaneous → Generate Full Page Screenshot
  • and others

If the PDF contains links or buttons, you can click them using a Text Inside or Link Text locator (since the HTML elements might not have attributes).

Note: convertPDFtoHTML does not require opening the PDF in a browser.


3. Computer Vision

You can validate the visual appearance of a PDF (or its HTML version) using:

Add Assertion → Page Matches Screenshot

This compares the rendered content with a baseline screenshot from a previous test execution.

Note: Using Computer Vision requires opening the PDF (or the generated HTML) in the browser so Endtest can capture and compare its visual output.


← How to test EmailsHow to test Chrome Extensions →
  • Introduction
  • Testing PDF metadata
  • Opening the PDF in the browser
  • Testing PDF content
    • 1. Extract Invoice Data from PDF using AI
    • 2. Convert the PDF into an HTML file
    • 3. Computer Vision
© Endtest Inc.