public void CloseWindowElementPositive(string actionRule, int windowsHandle) { // setup WebDriver = WebDriver.ApplyCapabilities(new Dictionary <string, object> { [MockCapabilities.ChildWindows] = NumberOfWindows }); // get window number for assertion var window = WebDriver.WindowHandles[windowsHandle]; // execute ExecuteAction <CloseWindow>(By.XPath("//positive"), actionRule); // assert that the window is now closed Assert.IsFalse(WebDriver.WindowHandles.Any(i => i.Equals(window))); }
public void CloseAllElementPositive(string actionRule) { // open child windows WebDriver = WebDriver.ApplyCapabilities(new Dictionary <string, object> { [MockCapabilities.ChildWindows] = NumberOfWindows }); // assert that at least numberOfWindows are currently active Assert.IsTrue(WebDriver.WindowHandles.Count > NumberOfWindows, MessageNoWindows); // execute ExecuteAction <CloseAllChildWindows>(By.XPath("//positive"), actionRule); // assert that all child windows are now closed Assert.IsTrue(WebDriver.WindowHandles.Count == 1, MessageStillActive); }