Re: org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window [InternetExplore]

3,814 views
Skip to first unread message

gayatri....@gslab.com

unread,
Jan 19, 2015, 2:13:54 AM1/19/15
to seleniu...@googlegroups.com
Hi Sahan,

I am also facing the same issue.Let me know if you have any workaround for this issue.

I am getting an error when selenium search for edit textbox.

Below is the stacktrace for selenium with IE11
Failed to Add the regex matched connector Message: u"Unable to find element on closed window (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 7 milliseconds\nBuild info: version: '2.40.0', revision: 'fbe29a9', time: '2014-02-19 20:54:28'\nSystem info: host: 'eremurus', ip: '10.35.34.91', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_25'\nDriver info: org.openqa.selenium.ie.InternetExplorerDriver\nCapabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, proxy={httpProxy=192.168.246.131:9090, proxyType=manual, ftpProxy=192.168.246.131:9090, sslProxy=192.168.246.131:9090}, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:43239/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=true, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]\nSession ID: 9150d287-7640-48ac-8273-c1888e44e763" ; Screenshot: available via screen ; Stacktrace:
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (None:-2)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance (None:-1)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (None:-1)
    at java.lang.reflect.Constructor.newInstance (None:-1)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable (ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed (ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:573)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement (RemoteWebDriver.java:326)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath (RemoteWebDriver.java:423)
    at org.openqa.selenium.By$ByXPath.findElement (By.java:357)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement (RemoteWebDriver.java:318)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (None:-2)
    at sun.reflect.NativeMethodAccessorImpl.invoke (None:-1)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (None:-1)
    at java.lang.reflect.Method.invoke (None:-1)
    at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke (EventFiringWebDriver.java:101)
    at com.sun.proxy.$Proxy2.findElement (None:-1)
    at org.openqa.selenium.support.events.EventFiringWebDriver.findElement (EventFiringWebDriver.java:184)
    at org.openqa.selenium.remote.server.handler.FindElement.call (FindElement.java:47)
    at org.openqa.selenium.remote.server.handler.FindElement.call (FindElement.java:1)
    at java.util.concurrent.FutureTask.run (None:-1)
    at org.openqa.selenium.remote.server.DefaultSession$1.run (DefaultSession.java:170)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
    at java.lang.Thread.run (None:-1)



On Tuesday, May 14, 2013 at 10:20:02 AM UTC+5:30, sahan reddy wrote:
Hi Everyone,

I am writing a testscript where i have to click a link,which in turn opens the new window[InternetExplorer].Now i have to perform few operations on the new windown[InternetExplorer]

This is Part of the code:

                        driver.findElement(By.xpath("*******")).click();
//Get all the window handles in a set
Set <String> handles =driver.getWindowHandles();
Iterator<String> it = handles.iterator();
//iterate through your windows
while (it.hasNext()){
String old = it.next();
System.out.println(old);
String new = it.next();
System.out.println(new);
                        //winHandleBefore contains the old window id only

if(!winHandleBefore.contains(new)){
                  driver.switchTo().window(newwin);
                  Thread.sleep(6000);
                          driver.findElement(By.xpath("****").click();
                   }
driver.close();
          driver.switchTo().window(old);
 }

Error in getting is : 


org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3 milliseconds
Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 20:21:45'
System info: os.name: 'Windows Vista', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0'
Session ID: 28d40847-5ef6-4c1c-b572-374a91f548a8
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, elementScrollBehavior=0, javascriptEnabled=true, enablePersistentHover=true, ignoreZoomSetting=false, browserName=internet explorer, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, version=8, cssSelectorsEnabled=true, ignoreProtectedModeSettings=true, requireWindowFocus=false, allowAsynchronousJavaScript=true, handlesAlerts=true, initialBrowserUrl=, nativeEvents=true, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:533)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:302)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:387)
at org.openqa.selenium.By$ByXPath.findElement(By.java:344)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:294)
at IExlorerB.main(IExlorerB.java:85)



Please guide me what to do ?

Regards,
Sahan


Ashish b lal

unread,
Jan 19, 2015, 3:09:57 AM1/19/15
to seleniu...@googlegroups.com
Wait for the New Window Pop up  open and then retrieve the  Windows Id.
Add Sleep

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5686e367-1cdd-4d39-a307-49ea1f1f060a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Hope to hear soon from you.
    
Thanks & Regards,
Ashish.B.LAL

Thirumurugan Dhasappan

unread,
Apr 20, 2015, 3:12:21 AM4/20/15
to seleniu...@googlegroups.com
org.openqa.selenium.NoSuchWindowException: Error retrieving window with handle current (WARNING: The server did not provide any stacktrace information)

can anyone help me to solve this issue.

Mukesh otwani

unread,
Apr 23, 2015, 3:32:09 PM4/23/15
to seleniu...@googlegroups.com
Hi Sahan,

is it running till the new window ? I mean before coming to new window is it working till that point.

If your script is not running from starting itself then I can figure out the exact issue.

Mukesh otwani

unread,
Apr 23, 2015, 3:33:13 PM4/23/15
to seleniu...@googlegroups.com
PLease paste ur code

Panikera Raj

unread,
Apr 24, 2015, 2:01:54 AM4/24/15
to selenium-users
HI Sahana reddy,


I thinks problem with below code, please re verify once again

while (it.hasNext()){
String old = it.next();
System.out.println(old);
String new = it.next();
System.out.println(new);
                        //winHandleBefore contains the old window id only

if(!winHandleBefore.contains(new)){
                  driver.switchTo().window(newwin);
                  Thread.sleep(6000);
                          driver.findElement(By.xpath("****").click();
                   }
driver.close();
          driver.switchTo().window(old);


 }



Regards,
Panikera

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Rony John

unread,
Dec 14, 2016, 6:48:54 AM12/14/16
to Selenium Users
Hi Mukesh,
I am facing the same exception. I am testing YahooMail on IE, i do not get this issue when i run YahooMail on Chrome or Firefox. neither do i get this exception when testing GMail on IE.

I did the registry entry for the Feature key ( iexplore.exe)
For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE.
 and it works. but the program is extremely slow and fails most of time.

Please suggest any options that i can try
Thanks.
Reply all
Reply to author
Forward
0 new messages