Cypress: Storing Values Into A Variable Synchronously
Hello People, As I have moved towards a new venture in my career, with which I have got opportunity to work with a great and an amazing tool named Cypress.IO . With my previous experience all being into Selenium and JAVA, it was challenging to learn and quickly get into the shoe with Cypress. In my journey of leaning, I got many difficulties as a beginner in Cypress, which I would like to share with all of you. So that it is easier for the people to quickly look and learn from it. So as we all know JavaScript is asynchronous due to its single-threaded programming feature. Thus it becomes very cumbersome to store the variable value taken out from any calculation or on-screen UI element to be used further for any verification purpose. It would always give a undefined value. Like in the below given example: Simply I visited a site and fetched an attribute using class, invoked its text and saved it into a variable named var1. Now as required, I printed the value of the variable...