Hi,
I am running IE 8 and Selenium 2.42.1
Please consider the below scenario:
1. Click on a link on page -> New IE window opens
2. Create a list of current window handles
3. Try to switch to each one of the handles
Problem: The frame does not exists anymore.
So what I wanted to check first is what happens in the time between when the second window appears for the first time and when I actually try to switch to it. For that I created a simple loop that samples all available window handles every 0.01 sec:
for i in range(30):
print "All sessions:"
for handle in self.driver.window_handles:
print handle
print self.driver.title
print "========"
time.sleep(0.01)
What I get is the following result:
All sessions:
ad5328c1-28a8-4990-a83e-4cf22e7444d6
394a069b-1f57-4e93-9465-da4ef3f72f7b
========
All sessions:
ad5328c1-28a8-4990-a83e-4cf22e7444d6
========
All sessions:
ad5328c1-28a8-4990-a83e-4cf22e7444d6
========
All sessions:
ad5328c1-28a8-4990-a83e-4cf22e7444d6
. . .
So initially, there are 2 handles/windows appear but you can see that after the first (sometimes it is second or third) sample the second, one of the handles disappear and only one is left.
What's even more interesting, is that when I check the driver title, it shows me the name of the first window but when I interact with the driver, I see that it is actually focused on the newly created window.
This all is super confusing and I hope that I my explanation makes sense. If it does not, please let me know and I will elaborate.
Will be great to hear some ideas as to why such behavior could occur? To me it looks like a bug.
Thanks!