https://cypress.io logo
I need to iterate over every element until i find ...
# help
b
I need to iterate over every element until i find a specific button. How can achieve this in cypress?
Copy code
let found =  false;
    cy.get('mat-panel-title').should('be.visible').each(($el, index) => {
      cy.wrap($el).click();
      cy.get('body').then(($body) => {
        if ($body.find('.startButton').filter(':visible').length) {
          console.log($body.find('.startButton').filter(':visible'));
          found = true;
        }
      console.log(found);
      if (found) return false;
      })
      // need to find button with class startButton
    });