Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

387
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda