Selenium Java code hangs after opening second window -


i facing bit strange issue here. entire script hangs when second window opened clicking button. next line after action system.out.println(); , doesn't print in console until manually close window. have added logic window handles , switch, doubt code reaches point. please find code below.

import java.util.set; import java.util.concurrent.timeunit; import org.openqa.selenium.alert; import org.openqa.selenium.by; import org.openqa.selenium.keys; import org.openqa.selenium.webdriver; import org.openqa.selenium.webelement; import org.openqa.selenium.ie.internetexplorerdriver; import org.openqa.selenium.ie.internetexplorerdriverservice; import org.openqa.selenium.keys; import java.util.iterator;  public class achcleartransfer { public static void main(string[] args){ system.setproperty("webdriver.ie.driver","c:/progra~1/iedriverserver.exe");     system.setproperty("webdriver.ie.driver.extractpath", "c://progra~1");       webdriver driver = new internetexplorerdriver();     try{         driver.manage().timeouts().implicitlywait(20, timeunit.seconds);         driver.get("https://xxxxxxxx.com");          thread.sleep(3000);         string parentwindowhandler = driver.getwindowhandle();         system.out.println("parent window handler "+parentwindowhandler);         driver.findelement(by.xpath("//input[@type='text' , @name='tbusername']")).sendkeys("********");         driver.findelement(by.xpath("//input[@type='password' , @name='tbpassword']")).sendkeys("*******");         system.out.println("entered id , password");         driver.findelement(by.xpath("//span[text()='log in']")).click();         driver.findelement(by.xpath("//input[@type='password' , @name='challengeanswer']")).sendkeys("*******");         driver.findelement(by.xpath("//span[text()='continue']")).click();         system.out.println("continue button clicked");         thread.sleep(5000);         system.out.println("thread sleep completed.");         string subwindowhandler = null;         try{             system.out.println("inside try");             set<string> handles = driver.getwindowhandles(); // window handles             system.out.println("all window handles "+handles);              for(string handle:handles){                 if(!parentwindowhandler.equals(handle)){                     subwindowhandler = handle;                 }             }                           }         catch(exception e){             e.printstacktrace();         }          driver.switchto().window(subwindowhandler);         system.out.println(driver.gettitle());         driver.close();         thread.sleep(2000);          driver.switchto().window(parentwindowhandler);          system.out.println("back in parent window");         system.out.println(driver.gettitle());         thread.sleep(2000);          driver.findelement(by.xpath(".//*[@id='navacc']/a")).click();         driver.findelement(by.xpath(".//*[@id='portfoliodepositsscheduledtransfers']/a")).click();          boolean temp = driver.findelement(by.xpath("(//a[text()='delete'])[1]")).isdisplayed();          while(temp==true){             driver.findelement(by.xpath("(//a[text()='delete'])[1]")).click();             thread.sleep(2000);             temp = driver.findelement(by.xpath("(//a[text()='delete'])[1]")).isdisplayed();          }     }     catch(exception e){         e.printstacktrace();     }     finally{         driver.quit();     } } } 

issue happens after pressing 'continue' button. opens new window. next system.out.println("continue button clicked") not displayed in console until close window manually. please help.

ps: please pardon coding style, try.

this old topic please verify iedriverserver version, old versions had problems when managing modal dialog windows (some problems fixed version 2.38, please refer changelog). help, having similar problem , updating version solved issue.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -