Testing · Middle · Question 56 of 75

Why can't you write const text = cy.get("h1").text() in Cypress?

Explanation

Commands are chained and executed asynchronously by Cypress; they are not promises and can't be awaited.

Further reading

Problem with a question

Testing · Middle · question 56

Test yourself

Take the Testing · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz