My web application is a banking application. After entering application URL in IE browser, it checks for browser configuration/resolution in that browser and immediately opens another browser which has the actual application without any Address Bar. I'm trying to switchTo
window and identify elements in browser two (where application is loaded).
switchTo
window is not working in my case. How to identify elements from this new window? Please help.
EDIT: I even tried switching to 2nd browser based on title of the browser. Still its not working.
public class Test {
public static void main(String[] args) throws Exception {
System.setProperty("webdriver.ie.driver", "C://Apps//IEDriverServernew.exe");
WebDriver driver = new InternetExplorerDriver();
driver.get("https://argoqa.snv.net");
Thread.sleep(8000);
String winHandleBefore = driver.getWindowHandle();
for(String winHandle : driver.getWindowHandles()){
driver.switchTo().window(winHandle);
}
//the above for loop iterates only once. shows only one window handle.
driver.switchTo().frame("iframeContent"); // 2nd Browser has frame.
Select bank = new Select(driver.findElement(By.name("selectRegionID"))); //trying to select bank
bank.selectByVisibleText("TEST BANK");
System.out.println("Selenium Webdriver Script");
driver.quit();
Runtime.getRuntime().exec("taskkill /F /IM iexplore.exe");
}
}
Change the registry for IE as shown below, and verify if the new window is detected.
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
Right-click → New → String Value → Value name: TabProcGrowth (create if not exist)
TabProcGrowth (right-click) → Modify... → Value data: 0