Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

Archives: FAQs

How to Get the descendent DOM elements of a specific selector

To get the descended DOM element of a specific locator, use cy.find() function as seen in the example below: For HTML Code The following command returns all ordered list (li) elements inside the unordered list (ul) element cy.get(‘#parent’).find(‘li’)

Locating Elements Containing Text

Get Element By Containing Text in CypressCypress provides contains() function along with the tag name and should be able to get the element.The above approach is most useful to find the href link by Text in CypressFor Example:cy.get(‘a:contains(“Forgotten password?”)’).first().click() Get DOM Element containing Text in CypressCypress provides contains() function, which can be used with cy …

Locating Elements Containing Text Read More »

Working with multiple matching element contains same attribute and value

Cypress provides various methods to work with the first element, last element, or element at a specific index, then you need to use the first(), last(), or eq() functions along with cy.get(). Get the first Element in CypressThe function .first() is used to get the first element in a set of elements For Example:cy.get(‘.name-text-box’).first() Get …

Working with multiple matching element contains same attribute and value Read More »

Cypress – Locators

Cypress only supports the Cascading Style Sheets (CSS) selectors to identify the elements.However, it can also work with xpath, with the help of the ‘Cypress-Xpath’ plugin. Syntax with attribute-id and tagname is tagname#id − input#user_email_login or #user_email_login Syntax with attribute-class and tagname is tagname.class − input.user_email_ajax or .user_email_ajax Syntax with any attribute value and tagname …

Cypress – Locators Read More »