Finding the element that causes the pop-up window using locators like ID, name, or CSS selector is the first step in automating the testing of a pop-up window using Selenium WebDriver.
After that, the pop-up window may be opened by using the click() function. Using WebDriver's switchTo() function, we can switch to the pop-up window and take the appropriate steps there. The same procedure may then be used to return to the main window.