qwerty1234567
qwerty1234567

Reputation: 255

Cypress get value from within

I've been trying to test my app by Cypress. Unfortunately, I encountered a problem with cypress.. I really want save an element that I've found in within method. However, there is a problem that I can't get this element - Cypress can't save it to variable ( in my code that's it element variable ).

Any ideas how can I save anything that I will find in within to variable that is declared outside the within method?

I'm talking about find method.

MyCode

Upvotes: 1

Views: 618

Answers (1)

ttquang1063750
ttquang1063750

Reputation: 863

Use as

ex:

cy.get('input').as('myInput')

cy.get('@myInput').should('be.visible')

Upvotes: 1

Related Questions