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

173
Views
asigne el valor devuelto por .invoke() a una variable en Cypress

estoy usando el siguiente código para obtener un valor de texto de un < td > :

 let serviceName; cy.get('tr').eq(1).then(row => { cy.wrap(row).find('td').eq(1).invoke('prop', 'innerText').then(val => { serviceName = val }); })

funciona bien en algunas páginas y no en otras con el mismo tipo de tabla/clase/etc. El front-end está construido con Angular

usar el mismo código como este también falla:

 let serviceName; cy.get('tr').eq(1).find('td').eq(1).invoke('prop', 'innerText').then(val => { serviceName = val }); })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar alias para esto.

 cy.get('tr') .eq(1) .find('td', {timeout: 5000}) .eq(1) .should('be.visible') .invoke('prop', 'innerText') .as('text') cy.get('@text').then((text) => { //access text here })
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!