Cypress Commands (Get, Click, Find)

In this tutorial, we will cover some commonly used Cypress Commands such as Get, Click and Find. We will also take a look at how to find the text of a particular element.

Cypress Get & Click Command

One of the most commands that you wil…


This content originally appeared on DEV Community and was authored by Automation Bro

In this tutorial, we will cover some commonly used Cypress Commands such as Get, Click and Find. We will also take a look at how to find the text of a particular element.

Cypress Get & Click Command

One of the most commands that you will use in Cypress is the ‘Get’ command. The ‘get’ command is used to access one or more DOM elements by a selector.

Usage:
commands-get

Cypress Get Text of an Element

There are multiple ways to get the text of an element in Cypress.

1 – Easiest option is via the assertion method:

commands-text

2 – This option you can use if you need to manipulate the text first:

carbon-gettext

Cypress Find Command

The ‘find’ command is used to get the descendant of a particular selector. For example, in the below code we are first accessing the nav menu by the id selector and then finding all the list items within the nav using the ‘find’ command.

find-command

Check out the video below to see learn more about the Get, Click, and the Find commands –

? Subscribe to my mailing list to get access to more content like this

? Follow automationbro on Twitter for the latest updates

...

I love coffees! And, if this post helped you out and you would like to support my work, you can do that by clicking on the button below and buying me a cup of coffee -

Buy me a coffee

You can also support me by liking and sharing this content.

Thanks for reading!


This content originally appeared on DEV Community and was authored by Automation Bro


Print Share Comment Cite Upload Translate Updates
APA

Automation Bro | Sciencx (2021-04-21T12:18:54+00:00) Cypress Commands (Get, Click, Find). Retrieved from https://www.scien.cx/2021/04/21/cypress-commands-get-click-find/

MLA
" » Cypress Commands (Get, Click, Find)." Automation Bro | Sciencx - Wednesday April 21, 2021, https://www.scien.cx/2021/04/21/cypress-commands-get-click-find/
HARVARD
Automation Bro | Sciencx Wednesday April 21, 2021 » Cypress Commands (Get, Click, Find)., viewed ,<https://www.scien.cx/2021/04/21/cypress-commands-get-click-find/>
VANCOUVER
Automation Bro | Sciencx - » Cypress Commands (Get, Click, Find). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/21/cypress-commands-get-click-find/
CHICAGO
" » Cypress Commands (Get, Click, Find)." Automation Bro | Sciencx - Accessed . https://www.scien.cx/2021/04/21/cypress-commands-get-click-find/
IEEE
" » Cypress Commands (Get, Click, Find)." Automation Bro | Sciencx [Online]. Available: https://www.scien.cx/2021/04/21/cypress-commands-get-click-find/. [Accessed: ]
rf:citation
» Cypress Commands (Get, Click, Find) | Automation Bro | Sciencx | https://www.scien.cx/2021/04/21/cypress-commands-get-click-find/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.