top of page

Basic Cypress commands

Updated: Apr 22, 2021

Here are the basic commands to interact with webpages in cypress.

1. Visit:


2. Contains:

cy.contains("any text")

3. Get:

cy.get("css selector")

4. should:

User for assertion

cy.contains("any text"). should('exists')
cy.get("css selector).should('have.text' , 'anytext')
cy.should('have.attr' , 'style', 'attribute value')

5. Viewport

cy.viewport(1200*720) //set resolution
cy.viewport("iphone-6") //device setting

6. Log


7. URL

cy.log('url = ',cy.url())
cy.log("the current url is",value)

8. Type

cy.contains("text").type("any text")

9. Pause


10. TimeOut:


13 views0 comments

Recent Posts

See All

A string s is called good if there are no two different characters in s that have the same frequency. Given a string s, return the minimum number of characters you need to delete to make s good. The f

The numeric value of a lowercase character is defined as its position (1-indexed) in the alphabet, so the numeric value of a is 1, the numeric value of b is 2, the numeric value of c is 3, and so on.

bottom of page