Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

391
Views
Unable to access elements of pdf viewer in a shadow host with Cypress

I am trying to access the value of "original-url". It appears to be in a "shadow host" but I have tried every syntax I can think of with no success. Attached below the code are some screenshots, thanks in advance for any guidance!

EDIT: I think it has something to do with the part of the page being a modal, or that somehow cypress is not seeing the part of the page containing the pdf

//snippet of the cypress code
context('Test',{ includeShadowDom: true }, () => {
    before(() => {
        cy.login();
    });

it('downloads the generated pdf form', { includeShadowDom: true }, () => {
    
        cy.get('.viewer').shadow().find('original-url').then(($pdfDest) => {
            
            const pdfUrl = $pdfDest.text()

            cy.downloadFile(pdfUrl, '/genPdfs/', genPdf.pdf)

        })
    })

//the element on the page using inspect

<embed id="plugin" type="application/x-google-chrome-pdf" original-url="blob:https://somewebsite.com/fbe361d4-9393-e8bc728d8b9c#toolbar=0&amp;view=fitH" src="chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/2bf57493-fbe8-499f-9437-6d42267ac53d" background-color="4283586137" javascript="allow" top-level-url="https://somewebsite.com/__/#/tests/integration/specialized/Test.spec.js" pdf-viewer-update-enabled="">

Inspection of the page: inspection of the page

Example cypress error: example cypress error same cypress error using # second cypress error

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your pdf-viewer element that contains shadow root has a "viewer" id, not a class.

So try cy.get('#viewer').shadow() instead.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!