Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.93 KB | None | 0 0
  1.  def WaitTillDisplayed (arg: String) {
  2.     new WebDriverWait(driver, 100).until(new ExpectedCondition[Boolean] {
  3.       override def apply(d: WebDriver) =  d.findElement(By.xpath(arg)).isDisplayed()
  4.     })
  5.   }
  6.  
  7.   def WaitTillDisplayedByElement (e: WebElement) {
  8.     new WebDriverWait(driver, 100).until(new ExpectedCondition[Boolean] {
  9.       override def apply(d: WebDriver) =  e.isDisplayed()
  10.     })
  11.   }
  12.  
  13.   def WaitTillAllDisplayed(arg: String){
  14.     new WebDriverWait(driver, 200).until(new ExpectedCondition[Boolean]{
  15.       @Override
  16.       override def apply(d: WebDriver)={
  17.         var count =0
  18.         val list = d.findElements(By.xpath(arg))
  19.         System.out.println(list.size())
  20.         for(i <- 0 to list.size()-1){
  21.           WaitTillDisplayedByElement(list.get(i))
  22.           if(list.get(i).isDisplayed)
  23.             count +=1
  24.         }
  25.         System.out.println(count)
  26.         count == list.size()
  27.  
  28.       }
  29.  
  30.     })
  31.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement