I have a test script that I need to automate: if a certain button is displayed on the page, then I need to click on it and continue with the next steps of the test. If the button is missing on the page, I also need to continue running the test.
All the solutions that I have found give an error when the button is not found, but I need this situation to be simply ignored
An example of something that is not suitable because it causes the test to fail:
dashboardPage.isVisible(showMoreReposButton, function(result) {
if (result.value) {
dashboardPage.click(showMoreReposButton);
}
});
if (dashboardPage.element(showMoreReposButton).isVisible()) {
await dashboardPage.element(showMoreReposButton).click()
}
Yulia is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1