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

419
Vistas
Click on element inside iFrame - Cypress

Can anyone, please assist in following:

Want to click element which resides on found iframe. Also, imported plugin import 'cypress-iframe'; in commands class. Code for founding iframe and clicking on element:

clickIFrameElement(elementCss, element1Css) {
    cy.frameLoaded(elementCss);
    cy.iframe(elementCss).find(element1Css).then(function(){
       cy.get(element1Css).click({ force: true })
    })
}

In test, I call this command:

cy.frameLoaded(elementCss).eq(0);
cy.iframe().find(element1Css).should('be.visible').click()

It does find iframe, but do not click on element. Error which get:

Timed out retrying after 20000ms: Expected to find element: #grouped-pageload-Banner button[class*="save-consents evSpAcceptBtn"], but never found it.

HTML for iframe: enter image description here

What I am doing wrong, or what is incorrect in code?

Thank you in advance

UPDATE

Tried also second approach with following command:

cy.iframe().find(#grouped-pageload-Banner button[class*="save-consents evSpAcceptBtn"]).should('be.visible').click()

But got second error:

cypress-iframe commands can only be applied to exactly one iframe at a time.  Instead found 7
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Please replace this line into your code

cy.iframe('#ifrmCookieBanner')
    .find('#grouped-pageload-Banner button[class*="save-consents evSpAcceptBtn"]')
    .should('be.visible')
    .click()

And put this in your support/index.js

Cypress.on('uncaught:exception', (err, runnable) => {
    // returning false here prevents Cypress from
    // failing the test
return false
})
about 4 years ago · Juan Pablo Isaza Denunciar

0

Check if the iframe URL belongs to the same domain of current window, otherwise, this cannot be executed for security reasons. But if you have how to install a Chrome extension in user, this action can be performed via content_script ;)

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