We are working with Selenium webdriver to make UI tests for Internet Explorer 11.
In the tested webapplication there are several screens popping up. In several tests we end up with three browserswindows, so also three Driver.WindowHandles.
To switch from one WindowHandle to the other we expected that Driver.WindowHandles would be sorted like the oldest windows first and the newest windows last. But this is not the case: It is totaly random!
Because a windowhandle is a GUID we ended up creating a dictionary with the WindowHandle GUID as key with the value of the type of page which is loaded in the browserwindow.
But this also results in maintaining the dictionary when closing a window for instance.
This seems to be a lot of work for such a simple matter. Is there a better solution for this?
Add a comment
|
1 Answer
Troubles with handling multiple windows is one of common traps.
Elemental Selenium has great explanation (and more interesting articles about common traps).
Catch is: order of windows is not guaranteed between browsers (it is not specified by standards). Google will give you many posts about this trap.