Not able to inspect one of the overlay which disappears in fraction of sec before page loads completely



  • 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;
        }
    }
    


  • 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.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2