To find the elements of the popup window on Selenium Java page, you can use the following method:
First, switch to the popup window using the getWindowHandle() method.
Then, use the findElement() method to locate the element on the popup window.
Example code:
// Switch to the popup window
String mainWindow = driver.getWindowHandle();
for(String handle : driver.getWindowHandles()) {
driver.switchTo().window(handle);
}
// Find element on the popup window
WebElement element = driver.findElement(By.id("elementID"));
// Do something with the element
element.click();
// Switch back to the main window
driver.switchTo().window(mainWindow);
Asked: 2022-08-12 11:00:00 +0000
Seen: 9 times
Last updated: Mar 31 '22