I have a method that clicks on a button, however; when it is ran, selenium returns the outcome as clicked successfully, but it does not get clicked. If i run the test several times, occasionally, it'll be clicked as expected. I have my test framework set as an implicit wait for about 15 seconds, I have set an explicit wait for this element, and still see the same issue. when i do .isDisplayed(); it is always found. I placed the .click in a while loop to click it a few times which works most of the time, however; still sometimes the test fails. Is it possible to set this in an if statement to check for an element on the next page by stating if this element is not displayed, click the button? I've tried:
If(!element.isDisplayed){
element.click
}
Here is the button I am having issues with:
<button class="notkoButton listNew">
<div class="l6e iconAdd">New List</div>
</button>
Here is my method:
public marketing_lists_page navigateToNewListPage() throws Throwable {
try {
int x = 0;
while(x < 5) {
newListBtn.isDisplayed();
x++;
}
//newListPageHeader.isDisplayed();
} catch (NoSuchElementException e){
logs.errorDetails("Could not navigate to New List Page");
Assert.fail();
}
return this;
}
Aucun commentaire:
Enregistrer un commentaire