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

232
Views
Cypress - manejo de iframe

Tengo un código que intenta capturar elementos dentro de un iframe, pero sigo recibiendo un error.

 it('Send Medication',function(){ cy.get('.aut-iframe') .should(iframe => expect(iframe.contents().find('body')).to.exist) .then(iframe => cy.wrap(iframe.contents().find('body'))) .within({}, $iframe => { cy.get('.pending-medication-check-box').click({force:true})

Este es el error que me sale:

ingrese la descripción de la imagen aquí

ingrese la descripción de la imagen aquí

Por último, esta es la información del iframe:

ingrese la descripción de la imagen aquí

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

0

Supongo que solo faltan reintentos para obtener el iframe hasta que se cargue el cuerpo. El simple combo get and should no espera a que esto suceda. Los documentos oficiales indican que debe usar .its('body') cuando trabaje con iframes, así que intente algo como esto:

 cy.get('.aut-iframe').its('body').then((body) => { cy.wrap(body).should('...') }

Referencia: https://www.cypress.io/blog/2020/02/12/working-with-iframes-in-cypress/#header

about 4 years ago · Juan Pablo Isaza Report

0

  1. Instale el complemento cypress-iframe .

  2. Después de la instalación, escriba import 'cypress-iframe'; bajo cypress/support/commands.js

  3. Entonces, finalmente, su código debería verse así:

 cy.frameLoaded('.aut-iframe') cy.iframe('.aut-iframe') .find('.pending-medication-check-box') .should('be.visible') .click()
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!