/// <summary> /// Performs the <paramref name="action"/> which causes new window to open. /// </summary> /// <param name="driver"></param> /// <param name="action">Action to perform which causes new window to open.</param> /// <param name="oldWindowHandle">Window handle for the existing window (in order to be able to switch back to it).</param> /// <param name="newWindowHandle">Window handle for the new window (in order to be able to switch to it and do something).</param> public static void NewWindow(this IWebDriver driver, Action action, out string oldWindowHandle, out string newWindowHandle) { oldWindowHandle = driver.CurrentWindowHandle; var finder = new PopupWindowFinder(driver, new TimeSpan(0, 1, 0)); newWindowHandle = finder.Invoke(action); }
protected void HandlePopup(Action lookupTrigger, Action lookupAction) { PopupWindowFinder popupFinder = new PopupWindowFinder(driver); String popupHandle = popupFinder.Invoke(lookupTrigger); String currentWindowHandle = driver.CurrentWindowHandle; driver.SwitchTo().Window(popupHandle); lookupAction(); driver.SwitchTo().Window(currentWindowHandle); }
public void SwitchToPopup(Action action) { SwitchToWindowByWindowHandle(PopupWindowFinder.Invoke(action)); SetCurrentWindowHandel(); }
/// <summary> /// Switch to a pop up window by invoking a method. /// </summary> /// <param name="methodToOpenWindow">Method to invoke for opening the pop up window.</param> public static void SwitchToPopupWindow(this IWebDriver driver, Action methodToOpenWindow) { PopupWindowFinder pop = new PopupWindowFinder(driver, TimeSpan.FromSeconds(15)); driver.SwitchToWindow(pop.Invoke(methodToOpenWindow)); }
public void SelectNewPopupWindow(Action popUpMethod) { var newWindowId = _popupWindowFinder.Invoke(popUpMethod); _driver.SwitchTo().Window(newWindowId); }