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

120
Views
¿Cómo usar el texto del elemento html en otras funciones que no son de cypre?

Necesito obtener texto del elemento html para usarlo en otras comprobaciones.

Pero esta verificación debe realizarse en otro lugar más tarde, no dentro de la función de obtención de texto.

Es por eso que una variante como

 > cy.get('#at__title').invoke('text').then((storedValue) => { > storedValue > })

no es then , porque solo puedo usar texto dentro de .

También traté de usar

 > cy.get('#at__title').invoke('text').as('element_text') > this.element_text

pero el registro de la consola muestra this.element_text como indefinido.

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

0

Usar un alias es correcto cy.get('#at__title').invoke('text').as('element_text') pero para acceder al valor de esta manera

 this.element_text

requiere que la prueba no sea una función de flecha.

Usa este formato

 it('test something', function() { this.element_text

O use la sintaxis más larga para acceder a un alias

 cy.get('@element_text').then(element_text => {
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!