switching to other tab in selenium code example

Example: how to handle tabs in selenium

How do we handle windows/tabs?
    - We have to switch driver's focus to different window to be able to 
    handle that one using window handles.
    
    - windowHandle: is a unique alphanumerical string randomly generated 
    for each window/tab.
    
    -> To get single window handle?
 -If we want to get the currently open window's handle: driver.getWindowHandle();
- What is the return type of driver.getWindowHandle();
        - String
-> How do we get all of the handles of the currently open windows?
    - driver.getWindowHandles(); 
    - Return type: Set<String>
    syntax: driver.switchTo().window(WINDOWHANDLE);

Tags:

Misc Example