-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
Description
Hi Selenium Team,
I’m quite new to Selenium, still learning and practicing, so apologies if this suggestion sounds basic.
Right now, driver.getWindowHandles() returns a Set. Since a Set is unordered, when we convert it into a List/ArrayList, the order of window handles is not guaranteed. Many beginners (including me at first) end up using indexing after converting it to a List, which doesn’t always give the expected result.
I know the best practice is to loop and check by title/URL, but I was thinking — would it make sense to provide an additional method like getWindowHandlesOrdered() which returns the handles in the order they were opened?
It might help people (especially beginners) who assume index-based navigation will work, and make test code a bit simpler in cases where order matters.
Thank you for considering this idea 🙏
Have you considered any alternatives or workarounds?
No response