chrome selenium c# switch to window 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;
}