Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To find the elements of the popup window on Selenium Java page, you can use the following method:

  1. First, switch to the popup window using the getWindowHandle() method.

  2. 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);