If I am giving the full class name for example: title-text-panel-container class-about-benefits > ul
cypress fails to identify the element and throws below error
CypressError: Timed out retrying: Expected to find element: '.title-text-panel-container class-about-benefits > ul', but never found it.
Why cypress fails to identify if we give full class name
in the test ? But it passes the test as we give the class name as per Test 2.
Test 1: Fails
cy.get('.title-text-panel-container class-about-benefits > ul').find('li').its('length').should('be.gte', 1);
Test: 2 Passes
cy.get('.title-text-panel-container > ul').find('li').its('length').should('be.gte', 1);
cy.get('.title-text-panel-container .class-about-benefits > ul')
– user8745435cy.get('[class^=something]')
- means the class list starts with 'something', orcy.get('[class*=something]')
- means the class list contains 'something'. – user8745435.
before the second class, I thought it was considered as a single class. Anyway thanks for explaining that. Second or third option is more easy shorter versioncy.get('[class^=something]')
orcy.get('[class*=something]')
– soccerway