mercredi 1 septembre 2021

org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters while check in if condition

I am writing a if condition to find the element location in my project.

    if (!(driver.findElement(MobileBy.xpath(ObjRepoProp.getProperty("searchTextBox_XPATH"))).isDisplayed()
            || driver.findElement(MobileBy.xpath(ObjRepoProp.getProperty("routeOverview_XPATH"))).isDisplayed()
            || driver.findElement(MobileBy.xpath(ObjRepoProp.getProperty("scrollNavigationDrawer_XPATH")))
                    .isDisplayed())) {
        throw new IllegalStateException("This is not Destination Input page");
    }

In this code if one of the condition become true then also "org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters." trigger and testcases failed.

Aucun commentaire:

Enregistrer un commentaire