Selenium : Smart way to switch to new window
var handlesBefore = webDriver.WindowHandles;
webDriver.Click(foo); //Which opens a new window
var handlesAfter = webDriver.WindowHandles;
var newHandle = handlesAfter.Except(handlesBefore).Single();
webDriver.SwitchTo().Window(newHandle);
Switch to a window with known name
No comments:
Post a Comment