IE - NoSuchWindowException: Unable to find elements on closed window (WARNING: The server did not provide any stacktrace information)

196 views
Skip to first unread message

Vaibhav Srivastava

unread,
Oct 18, 2016, 8:56:05 AM10/18/16
to webdriver
Hi,

We have an application we need to automate using Selenium web driver with Java. We are getting the error message while running the code. Please guide us on this.
It would be a great help.

We have described the scenario below :


1) Enter the URL of application on IE 11 browser (Application is supported on IE browser only)
2) A pop window opens in which we enter the username and password and click on Login. This pop window is closed.
3) The application opens and is basically build up on frames.

We have written below code for it :

public void login() throws Throwable
{
System.setProperty("webdriver.ie.driver", System.getProperty("user.dir") + "\\src\\test\\resources\\drivers\\IEDriverServer.exe");
driver = new InternetExplorerDriver();
// Enter the URL on browser 
driver.get(config.getProperty(URL));
// Switch ctrl to the popup window
Set<String> windows = driver.getWindowHandles();
System.out.println(windows.size());
String mainWindow = (String) windows.toArray()[0];
System.out.println("Main Window" + " " + mainWindow);
String subWindow = (String) windows.toArray()[1];
System.out.println("Sub Window" + " " + subWindow);
driver.switchTo().window(subWindow);

// Enter username, password and click on Login
driver.findElement(By.xpath(config.getProperty(username))).sendKeys(data.getProperty(userName));
driver.findElement(By.xpath(config.getProperty(password))).sendKeys(data.getProperty(password));
driver.findElement(By.xpath(config.getProperty(login))).click();
Thread.sleep(5000);

// Switch ctrl back to main 
driver.switchTo().window(mainWindow);

// Move ctrl to the frame
driver.switchTo().frame("quickfind");
// Enter text on text field
driver.findElement(By.xpath(config.getProperty(test))).sendKeys(data.getProperty(value));
}

Now when we execute this code we are getting below error message :


FAILED: login
org.openqa.selenium.NoSuchWindowException: Unable to find elements on closed window (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 13 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: 'hostname', ip: '127.1.1.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, ie.enableFullPageScreenshot=true, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.forceShellWindowsApi=false, pageLoadStrategy=normal, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:36369/, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: deac9eab-920c-4220-b006-611ce4ed1c3a
*** Element info: {Using=css selector, value=frame[name='quickfind'],iframe[name='quickfind']}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

Reply all
Reply to author
Forward
0 new messages