<object type="application/pdf" /> and <iframe /> not showing PDF in Chrome headless mode
See original GitHub issueTest 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:
- Created 3 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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 notChrome/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.
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.