Answer the question
In order to leave comments, you need to log in
Not counting DOM elements in React using Cypress?
It is not possible to count the number of DOM elements on a site written in React.
/// <reference types="cypress" />
context('Checking all components', () => {
beforeEach(() => {
cy.visit('https://news-israel.com');
});
it('Checking posts', () => {
cy.get('.post-wrapper').find('a').should('exist');
cy.get('.post-wrapper').find('a').its('length').should('be.gte', 100);
});
});
The following error originated from your application code, not from Cypress.
> Cannot read property 'substr' of undefined
When Cypress detects uncaught errors originating from your application it will automatically fail the current test.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question