

The set is part of Java collection which allows us to handle multiple sets of data dynamically. We also have getWindowNames, which will return Set it means the set of window names then we can iterate using Iterator. I have also published a video on this which will give you a clear idea how this works.Īpproach to handle multiple windows in selenium webdriver Note- Selenium 4 has a new feature where you can switch between tabs as well. In Selenium, we have the getWindowName method that will return the current window name in String form. In Selenium, we have the feature that we can get the window name of the current window. I will focus on multiple windows as of now.īefore starting this section I will recommend you watch Listand Setin Java which will help you to understand this concept in detail. Using the switch To method we can also handle framesand alertswith easy methods. If you have to switch between tabs then also you have to use the same approach. If you are working with web applications then you must have faced this scenario where you have to deal with multiple windows. We can handle multiple windows in selenium webdriver using Switch To methods which will allow us to switch control from one window to another window.
