Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

392
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda