c# selenium ie switch windows code example
Example: c# selenium ie switch windows
protected static Boolean SwitchWindow(string title)
{
var currentWindow = driver.CurrentWindowHandle;
var availableWindows = new List<string>(driver.WindowHandles);
foreach (string w in availableWindows)
{
if (w != currentWindow)
{
driver.SwitchTo().Window(w);
if (driver.Title == title)
return true;
else
{
driver.SwitchTo().Window(currentWindow);
}
}
}
return false;
}