Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. public void E_WaitUntilElementDisplay() throws Exception
  2. {
  3.     int i=1;
  4.     boolean eleche,eleche1 = false;
  5.     while(i<=1)
  6.     {
  7.             try{
  8.                 eleche = driver.findElements(by.xpath("path")).size()!=0;
  9.             }catch(InvalidSelectorException ISExcep)
  10.             {
  11.                 eleche = false;
  12.             }
  13.             if(eleche == true)
  14.             {
  15.  
  16.                 while(i<=1)
  17.                 {
  18.                     try{
  19.                         eleche1=driver.findElement(By.xpath("Path")).isDisplayed();
  20.                     }catch(org.openqa.selenium.NoSuchElementException NSEE){
  21.                         eleche1=false;
  22.                     }
  23.                     if(eleche1 == true)
  24.                     {
  25.                         i=2;
  26.                         System.out.println("\nElement Displayed.");
  27.                     }
  28.                     else
  29.                     {
  30.                         i=1;
  31.                         Thread.sleep(1500);
  32.                         System.out.println("\nWaiting for element, to display.");
  33.                     }
  34.                 }
  35.             }
  36.             else
  37.             {
  38.                 i=1;
  39.                 Thread.sleep(1500);
  40.                 System.out.println("\nWaiting for element, to display.");
  41.             }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement