vendredi 8 juillet 2022

Automated test passes but checkbox is not checked(selected)

I have the following element:

'''<input id="InventoryTrackingAllowOutOfStockPurchases" name="allowOutOfStockPurchases" type="checkbox" class="Polaris-Checkbox__Input_30ock" aria-invalid="false" role="checkbox" aria-checked="false" value="">'''

I use the following code in order to check if the checkbox is checked:

 WebElement sellWithoutStock = driver.findElement(By.name("allowOutOfStockPurchases"));
            sellWithoutStock.isSelected();

The thing is that I run the test when the checkbox is unchecked but still the test passes. By running the test I just want to confirm whether the checkbox is checked or not. Any ideas about what I'm doing wrong here? Thanks




Aucun commentaire:

Enregistrer un commentaire