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

149
Vistas
How can I access the variable declared inside then function?

I want to access the input value given/already present in the input field. I am trying the below solution but I can't access it outside the then function.

    let name
    cy.visit('/')
    cy.get('[id=username]').type("Kanye")
    cy.get('[id=username]').then((input) => {
      name = input.val()
      cy.log(name)  //Works here
    })
    cy.log(name)    //Does not work here

Can you help me modify this function? Or suggest me any alternative I can use.

about 4 years ago · Juan Pablo Isaza
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