In this article, we will see some of the browser and action commands in cypress.
Browser commands in Cypress
To open a web application
To navigate backward. This is equivalent to clicking back button in the browser.
To navigate forward. This is equivalent to clicking back button in the browser.
Refreshes the webpage
To open a browser with set width and height
The preset dimension contains the default width and height for the phones and laptops provided by cypress.
example of preset width and height of few devices
ipad-2 |
768 |
1024 |
ipad-mini |
768 |
1024 |
The entire list can be found in official documentation of cypress.
To get the current URL of the web page. We need to resolve the promise for the URL function so that we can print URL in the console.
To get the current title of the webpage. We need to resolve the promise for the title function so that we can print URL in the console.
Action Commands in Cypress
click
This command is used to click on the element. The get is used to locate the element in the web page using locator. Cypress supports the default CSS selector locator.
Few other click commands
clear
To clear value from text box
type
type value in text box
check and uncheck
check a checkbox or radio
uncheck a checkbox or radio
select
select an option from dropdown
Hope these commands will be useful in test automation
Thank you
Happy learning.......