Hi Jim.
I have recently been dusting off and upgrading a very old Selenium testing project to use the "new" Selenium webdrivers, and encountered this issue using Python against IE 11.
My scripts are running normally for pressing buttons, accessing links, entering text, etc., but fail to recognise child windows opened by clicking on an application link. The issue issue does seem to be related to the content of window_handles, and I have attached two files that minimally show the problem, with the number or entries in window_handles sometimes briefly showing 2 before dropping back to 1, while both the parent and child windows are still open.
I first encountered the error running against a normal intranet IIS web application, not on local files, but the attached local files exhibit the same behaviour.
As far as I can tell I have set up Selenium / Python / IE correctly.
The only thing that I'm not particularly sure about is the Protected Mode setting for each Zone. IE Protected Mode Settings are locked down and this initially blocked my Selenium scripts from running at all. I did NOT use the "flakiness" capability flag, but instead used a routine to poke registry settings to turn protected mode ON for all zones (
https://stackoverflow.com/a/45619945). I also tried turning OFF protected mode in all zones, but still have the same non-recognition of opened windows issue.
I am using the 32-bit IE webdriver, because the 64-bit version gave me a "Connection
forcibly closed by remote host" error. If necessary I can attempt to go back and get the 64-bit driver running.
Additional windows are recognised in Firefox just fine but unfortunately, for reasons, I must run this application in IE.
I hope that the attached files can help in identifying the cause of this issue, especially if the cause is something that I can fix locally.
Thanks for your great work,
Philip Robinson