cypress: How can manage the application flow, if the element xpath is not present
问题 I have the following scenario: if the element is present, i have to do one activity and if not present will do another activity. cy.xpath("//div[text()= 'button').its('length').then(res=> { if (res > 0) { return 1; } else { cy.log ("Element is not present") } } )} ''' if element is present = Code is working fine, if the element xpath is not present = it try to search the element xpath (//div[text()= 'button') and throwing the error as 'Timed out retrying: Expected to find element: undefined,