Test Automation
Basic Commands and Functionalities
1. cy.visit()

Functionality: Loads a remote URL into the Cypress Test Runner.

 cy.visit('https://example.com')

2. cy.get()

Functionality: Queries for an element in the DOM using a CSS selector.

cy.get('button').click()

3. cy.contains()

Functionality: Finds an element containing specific text.

cy.contains('Submit').click()

4. cy.click()

Functionality: Finds an element containing specific text.

cy.get('.btn').click()

5. cy.type()

Functionality: Types text into an input field or textarea.

cy.get('input[name='email']').type('test@example.com')

6. cy.clear()

Functionality: Clears the value of an input or textarea.

cy.get('input[name='search']').clear()

7. cy.select()

Functionality: Selects an option in a `` dropdown.

cy.get('select').select('Option 1')

8. cy.check()

Functionality: Checks a checkbox or radio button.

cy.get('input[type='checkbox']').check()

9. cy.submit()

Functionality: Submits a form.

cy.get('form').submit()

10. cy.wait()

Functionality: Waits for a specified amount of time or waits for a specific route to complete.

  cy.wait(1000) // Wait for 1 second
  cy.wait('@getData') // Wait for a specific route

Get Updates

Have a doubt?
Post it here, our mentors will help you out.