0

Once i reset the password through selenium script the confirmation overlay page just remains for 2 sec which i`s not captured by selenium to inspect. Please suggest me how to capture/ignore that step and continue to next step?

Please find script pattern below:

driver.findElement(By.xpath("//form[@id='resetPassword']//input[@class='aButton grnBtn ae-button']")).click();
      try
         {
           WebElement element= driver.findElement(By.xpath("//ul//li[6][@id='logoutLink']//a"));
         }
      catch(TimeoutException toe)
      {
           WebDriverWait wait = new WebDriverWait(driver,5000);
          wait.until( ExpectedConditions.presenceOfElementLocated(By.xpath("//ul//li[6][@id='logoutLink']//a")));
          driver.findElement(By.xpath("//ul//li[6][@id='logoutLink']//a")).click();
                 }
          //System.out.println("Password reset successfully");
          Boolean isPresent = driver.findElements(By.xpath("//header[@id='mainHeader']/div/nav[contains(@class,'right no_print')]/ul/li[5]")).size() > 0;
    }
}
0

xpath is the slowest way to match an element , you could use By.id to give yourself a fighting chance.

your element looks like 'logoutLink' is a unique id do you should be safe to just match it directly by id or class without the previous tags. They are slowing you down.

0

If ignoring that step is acceptable, then just ignore it -- remove the handling code, and let the next step's code take control naturally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.