What is window handling in Selenium?

What is window handling in Selenium?

In any browser, a window is the main webpage to which the user is directed after clicking a link/URL. The parent window, also known as the main window, is a Selenium window that appears when a Selenium WebDriver session is created and receives all of the WebDriver’s attention.

Selenium Webdriver provides us for window handles.

– driver.getWindowHandle() – We can get the current window’s handle

– driver.getWindowHandles() – We can get all windows handles

– driver.switchTo().window(String handle) – We can switch to the target window by using its handle.