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

145
Views
Resultados de Cypress con el error "eventos de puntero: ninguno" al usar la condición, ¿qué debo hacer?

Código

resultado de ciprés

Quiero hacer clic en el botón Siguiente para probar la paginación, hasta que su clase esté "deshabilitada". Usé el código de abajo. Pero continúa haciendo clic incluso en el botón "Siguiente" que tiene la clase "deshabilitada". Y Cypress arroja el error en el archivo adjunto.

 static pagination(){ var index = 0 cy.get('li [data-test="page-link"]:not(.active):not([aria-label="Next"]) :not([aria-label="Previous"]').as("pages") cy.get('@pages').its('length').then( len =>{ if(index <= len){ cy.get('[data-test="page-link"][aria-label="Next"]').then( next=>{ cy.wrap(next).invoke('hasClass', 'disabled').then( classDisable =>{ if(classDisable==false){ cy.wait(500) cy.wrap(next).should('not.have.class', 'disabled') cy.wrap(next).click() } this.pagination() index++ }) }) } }) }
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Puede ser posible evitar la verificación condicional por completo.

Si puede obtener el número en el cuadro a la izquierda de "Siguiente", supongo que .prev() lo obtendrá, pero es posible que deba ajustar ese paso.

Luego puede hacer clic en() pageCount-1 veces.

 cy.get('[data-test="page-link"][aria-label="Next"]') .prev() // last page box .invoke('text') .then(lastPageText => { const pageCount = +lastPageText; Cypress._.times(pageCount -1, () => { cy.get('[data-test="page-link"][aria-label="Next"]').click() }) })
about 4 years ago · Juan Pablo Isaza Report

0

Intente establecer la opción de fuerza en verdadero en el siguiente clic.

 cy.wrap(next).click({ force: true} )
about 4 years ago · Juan Pablo Isaza Report

0

Si desea hacer clic en el botón deshabilitado, debe usar {force: true}

 cy.wrap(next).click({force: true})

Y, si desea verificar primero si el botón está habilitado o no y luego hacer clic, puede hacer algo como:

 cy.get('[data-test="page-link"][aria-label="Next"]').then(($next) => { if ($next.is(':enabled')) { //next button is enabled cy.wrap(next).click() } else { // Do something when next button is disabled } })
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!