Automated Testing

WebViewer Version: 8.11.0

Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? Yes
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? Yes (selenium)
Is your issue related to annotations? No

Please give a brief summary of your issue:
Automation unable to find PDFTron Canvas element for automation testing

Please describe your issue and provide steps to reproduce it:
We are attempting to build automation tests to mimic some of our user workflows that involve loading a pdf document with PDFTron, drawing/annotating it, and then performing a save/submission process, but are running into a blocker.

When running our automation tests the PDFTron viewer does not load our example PDF. We have added in minute + waits seeing if it was just due to a delay but the PDF/canvas
never appears. In the browser it appears within seconds even without touching anything so we are unsure what the trigger is for PDFTron to load. We have tried scrolling and moving the cursor to see if that would trigger without luck. Attached is a screenshot from our automation, you can see the shell is rendering with the toolbar, but our example pdf does not display as in the 2nd attached screenshot.

Our selenium nodes run on a “no interface” environment, so they all run headless. Unclear if this is part of the cause. Do you all have other ideas on what we can try so that we are able to do automation testing including PDFTron in the workflow?

sample_pdf (1).pdf (16.1 KB)

example PDF we are using


Hello iybar,

Can you provide a sample project to reproduce this issue?

Best regards,

Unfortunately, not without a lot of effort. Are there any ideas for what we could try on our end to get the pdf to render within the webviewer in our automation? Has there ever been other support cases related to running headless automation that we could try?

Hello iybar,

We use headless automation for our testing in our backend (using Playwright), so we have experience with this.

  1. Can you provide how you’re setting up the test at all?
  2. Are you calling loadDocument? are you awaiting it?
  3. How are you storing your documents for testing?

Unfortunately, we cant provide any helpful suggestions by shooting in the dark.

Best regards,