mardi 12 juin 2018

If page does not load properly, how to refresh

driver.findElement(By.xpath("//td/a[contains(text(),'Seller Catalog')]")).click();

In my code, if I execute above line sometimes, it displayed next page properly, but sometime it's displayed blank page.

Next page content below element. //div/label[contains(text(),'Document Type')]

I need to refresh the page, only if blank page display, else continue the code. Even I try bellow scenario, it wasn't success.

**if (!driver.findElements(By.xpath("//div/label[contains(text(),'Document Type')]")).isEmpty()) {

        driver.navigate().refresh();
    } else {
        // DO SOMETHING ELSE AS SUBMIT BUTTON IS NOT THERE

}**

Can I know is there any way to complete this?

Thanks ..

Aucun commentaire:

Enregistrer un commentaire