title: How to handle multiple jQuery popup with selenium webdriver
body: <p>I am working on java with selenium webdriver 2.39, we have application where multiple 'processing' popup is display for 2-5 sec and closed automatically, that is depend on data. Now, the question is how to handle this popup, this popup are jQuery popup. My script can only work further once all this three popup gets open and process data and get closed automatically. However, I can not use wait time as this script is used for load testing using JMeter, hence the process time may take more or less than 5 sec., Is there any way we can know if the popup exist or not on screen? I have used below given sample code but it returns only parent window and it does not identify jQuery popup, using below given code I can get if popup exist or not, but only if it is not jQuery popup. Can anyone help me?</p>
  
  <pre><code>public void FocusOnWindow() throws Exception{
  
      int i=0;
  
      do {
          handles=driver.getWindowHandles();//get all windows
          iterator = handles.iterator();
          if(iterator.hasNext()){
              subWindowHandler = iterator.next();
              if(subWindowHandler==null){
                  i=0;
              }else if(subWindowHandler!=null){
                  if(subWindowHandler!=parentWindowHandler){
                      popup = true;
                      i=2;
                  }
              }
          }
      }while(i&lt;2);
      if(popup){
          do{
              handles=driver.getWindowHandles();
              iterator = handles.iterator();
              Thread.sleep(500);
              if(iterator.hasNext()){
                  subWindowHandler = iterator.next();
                  if(subWindowHandler!=parentWindowHandler){
                      if(subWindowHandler==null){
                          String source = driver.getPageSource();
                          if(source==null){
                              i=2;
                          }
                      }
                  }else {
                      i=0;
                  }
                  //System.out.println("No any other popup.");
              }
  
          }while (i&lt;2);
      }
  }
  </code></pre>