1

I am using internet explorer for automating a website process. The website functions only in internet explorer and I can't use any other browser.

Tech used : Python3, Selenium, InternetExplorer

The code works perfectly for chromedriver. However, for InternetExplorer after performing a click on the first page, nothing works and the next steps begin to crash.

I tried debugging for error by pressing F12 to open Developer Console. Surprisingly enough, everything begins to work perfectly well, with a few minor glitches.

Could someone explain me how this can be fixed. Are there some preferences I need to change in order for me to be able to access the functionality without Developer Console.

I was getting the following error :

NoSuchWindowException: Currently focused window has been closed

Alternately, I tried to perform click by javascript using document.findElementByID().click(), works for certain cases not all.

Mayank
  • 1,364
  • 1
  • 15
  • 29
  • 1
    Does [this](https://stackoverflow.com/questions/51775122/nosuchwindowexception-no-such-window-window-was-already-closed-while-switchi/51788519#51788519) helps you? – undetected Selenium Jul 11 '19 at 07:00
  • @DebanjanB I have tried the steps mentioned in the post. I am not switching the window though, but yet I tried both WebDriverWait and time.sleep(). The click works for dropdown menu, but not for the buttons even then. – Mayank Jul 11 '19 at 07:32

1 Answers1

0

When you attempt to interact with a selenium element, you get:

Exception in thread "main" org.openqa.selenium.NoSuchWindowException: Currently focused window has been closed.

Make sure you have changed the protected mode (see above: https://github.com/seleniumQuery/seleniumQuery/wiki/seleniumQuery-and-IE-Driver#change-the-protected-mode-in-all-zones).

Also, again, did you execute all steps of the Required Configuration?

In case you are in doubt, the last point:

For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

Is the same as executing a .reg file with this content (example for the windows 64 bits above):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE]
"iexplore.exe"=dword:00000000

Reference:

NoSuchWindowException: Currently focused window has been closed.

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19
  • If the issue persist than try to provide detailed information about your issue and try to provide the steps and sample code to reproduce the issue. We will try to check and test the code to see the results. – Deepak-MSFT Jul 11 '19 at 08:04