I have an requirement of running test cases in CI pipeline. where the VM is linux. Selenium multiple window handling - switchTo()
method throws exception for linux platform.
Exception:
org.openqa.selenium.WebDriverException: invalid argument: 'handle' must be a string
Code trials:
driver.switchTo().window(subWindowHandler);
Its declared as per multiple window handle way:
String subWindowHandler = null;
Set<String> handles = driver.getWindowHandles();
Iterator<String> iterator = handles.iterator();
while (iterator.hasNext()) {
subWindowHandler = iterator.next();
}
This code works perfectly in local windows system.