question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<object type="application/pdf" /> and <iframe /> not showing PDF in Chrome headless mode

See original GitHub issue

Test code to reproduce

I have the following code in the app which renders a PDF document using Chrome’s built-in PDF renderer.

<object 
  type="application/pdf"
  data="http://www.africau.edu/images/default/sample.pdf"
  width="100%"
  test-id="embedded-preview"
  style="height: calc(100vh - 120px);"
>
   Document preview
</object>

Current behavior:

When running through the cypress app everything works fine. But, when running using cypress run --browser chrome --headless or cypress run --browser chrome the test fails and later checking the video, I see that the PDF is not rendered. Instead, for the headless mode it shows the alternative text (Document preview string in the above case) and for the headed mode nothing is shown.

Desired behavior:

I want a PDF to be rendered when running the tests using cypress run same as how it gets rendered when using “cypress open”.

Versions

Cypress 4.9.0 Google Chrome, Version 84.0.4147.89 (Official Build) (64-bit) OS: Ubuntu 20.04, 5.4.0-40-generic #44-Ubuntu

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
crorafcommented, Jul 22, 2020

@jennifer-shehane I made a minimal example now with Cypress 4.11.0. and I get the same results as you do. (You just made a typo in the caption above first image. The first image is behavior in Chrome headed / Firefox headless and headed as you said above in the text and not Chrome/Electron headed)

Also, a minor (perhaps not important) difference I see now from what I originally reported is the following. In my real project tested with Cypress 4.9.0 the Chrome headed didn’t show anything (nor the PDF nor the alt text). But this might be due to test itself.

0reactions
ckxddd0324commented, Jul 28, 2021

Any updates on this 😦 . It is still happening. Configuration:

  • Cypress version 7.5.0.
  • Chrome version: Version 91.0.4472.77 (Official Build) (64-bit)
  • OS: Ubuntu 5.4.0-45-generic #49-Ubuntu SMP Wed Aug 26 13:38:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

It is also happening with iframe trying to show pdf.

Is the pdf embedded on the page? I am experience something similar as well, the Cypress runner is unable to load the PDF on the page, but if I would open the page with another one it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google chrome dose not show pdf in iframe - Stack Overflow
I tracked down the issue The iframe is being block by chrome detecting insecure content and blocking the iframe from loading. this only ......
Read more >
Object iframe is not present on Headless Chrome, please help
Hi, I have created my automation test as below: //Katalon version = 7.0.0 //Selenium version = 3.141.59 //Chrome version = 78.0.3904.
Read more >
Puppeteer HTML to PDF Generation with Node.js
Learn to generate a Puppeteer PDF document from a heavily styled React page using Node.js, headless Chrome and Docker.
Read more >
Posts made by rconstantine - jsreport forum
RE: big PDF to iframe not working. Thanks that worked. ... I'm having reports run from requests by my web client application. I...
Read more >
How Do I show the pdf in the html?I have used angular js to ...
You have to display a pdf as an image in HTML M... ... or else the other way to add a pdf is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found