I am using Edge with IE compatibility (IEDriverServer) with Selenium and Java. At a certain point I do a click, and a new window opens. When I do this locally from my machine, driver.getWindowHandles() will show the new window (2 windows), but when I do this on the Selenium grid, only one window shows (the original) and it cannot find the new HMTL. The setup (IEdriverServer options etc) are the same. The only difference is the machine on which it is running (and running remotely). My guess is on the remote machine the new Window may be on a different machine as there are two, the grid machine and the display machine?
Edge: Version 116.0.1938.54 (Official build) (64-bit) IEDriverServer: 4.10.0.0
Here is a bit of code sample:
String xp = "//a[@id='iframe_DocList']";
WebElement view driver.findElement(By.xpath(xp));
// We have a check to verify view is not empty
view.click();
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
}
// Here is where I find the window. Locally driver.getWindowHandles() has 2 windows/
// On grid there is just 1
for (int i = 0; i < 2 && !found; i++) {
for (String d : driver.getWindowHandles()) {
driver.switchTo().window(d);
// the new window should have an iframe 'DocSelectPage'
if (driver.findElements(By.xpath("//iframe[@id='DocSelectPage']").size()) !=0) {
found = true;
break;
}
}
}
a cross-section of the HTML:
<td><a onclick="return onclick_DocType();" id="iframe_DocList"
class="fauxButton" style="WIDTH: 108px;
PADDING-BOTTOM: 2px; PADDING-TOP: 2px; PADDING-LEFT: 8px;
PADDING-RIGHT: 8px" href="" target="_blank">View Documents</a>
</td>