public void IEModalDialogsSupport() { Manager.LaunchNewBrowser(BrowserType.InternetExplorer, true); ActiveBrowser.NavigateTo(Path.Combine(TestContext.TestDeploymentDir, TESTPAGE2)); // Open the popup using mouse click so it doesn't hang execution. Find.ByAttributes <HtmlInputButton>("type=button").MouseClick(); // ** Special IE Code. Given that IE Dialog is an IE specific feature. if (ActiveBrowser.BrowserType == BrowserType.InternetExplorer) { InternetExplorerActions ieActions = (InternetExplorerActions)ActiveBrowser.Actions; // Connect the dialog ieActions.ConnectIEDialog("THIS IS A MODAL DIALOG", 300); Manager.WaitForNewBrowserConnect("dialog.html", true, 10000); Assert.IsTrue(ActiveBrowser.IsIEDialog); // The ActiveBrowser instance is now the dialog instance. Do what ever you want with the dialog ActiveBrowser.Find.ByTagIndex <HtmlContainerControl>("H1", 0).BaseElement.SetValue <string>("style.backgroundColor", "red"); // Once done, make sure to close the dialog. // Even if the dialog is closed due to a button click within the dialog, you still need this line // at this point to revert the ActiveBrowser instance to the main instance. We are searching for a // good approach to make this automatic. ActiveBrowser.Close(); } Assert.IsFalse(ActiveBrowser.IsIEDialog); // The ActiveBrowser is back to the main browser window. ActiveBrowser.NavigateTo("http://www.google.com"); }
public void AccessHTMLPopups() { Manager.LaunchNewBrowser(); ActiveBrowser.NavigateTo(Path.Combine(TestContext.TestDeploymentDir, TESTPAGE)); // Set new browser tracking to enabled. // This will make all new browser instances connect to // the Manager. Manager.SetNewBrowserTracking(true); // Invoke the popup Actions.Click(this.Elements.GetHtml("mylink")); // Wait for the new browser instance to connect. Manager.WaitForNewBrowserConnect("www.bing.com", true, 3000); // disable new browser tracking Manager.SetNewBrowserTracking(false); // At this point the browsers collection should have two // browser instances. ActiveBrowser should be set // to the popup instance. Assert.AreEqual(2, Manager.Browsers.Count); Assert.IsTrue(ActiveBrowser.Url.Contains("www.bing.com")); // Close the popup ActiveBrowser.Close(); // At this point, the browsers collection should contain // only one instance and the ActiveBrowser is set to // the last launched active instance. Assert.AreEqual(1, Manager.Browsers.Count); Assert.IsTrue(ActiveBrowser.Url.Contains(Path.GetFileName(TESTPAGE))); }
public void PreviewMultipageForm() { BAT.Macros().NavigateTo().Modules().Forms(this.Culture); BAT.Wrappers().Backend().Forms().FormsDashboard().OpenFormFromTheGrid(FormName); BATFeather.Wrappers().Backend().Pages().PageZoneEditorWrapper().EditWidget(TextField); BATFeather.Wrappers().Backend().Forms().FormsContentScreenWrapper().ChangeTexboxLabel(FormName1TextBox); BATFeather.Wrappers().Backend().ContentBlocks().ContentBlocksWrapper().SaveChanges(); BATFeather.Wrappers().Backend().Pages().PageZoneEditorWrapper().EditWidget(CheckboxField); BATFeather.Wrappers().Backend().Forms().FormsContentScreenWrapper().ChangeLabel(FormName1Checkbox); BATFeather.Wrappers().Backend().ContentBlocks().ContentBlocksWrapper().SaveChanges(); BATFeather.Wrappers().Backend().Forms().FormsContentScreenWrapper().ClickPreviewButton(); BATFeather.Wrappers().Frontend().Forms().FormsWrapper().VerifyNavigationPagesLabels(this.pagesDefaultLabels); BATFeather.Wrappers().Frontend().Forms().FormsWrapper().VerifyIfFieldExistInPreviewMode(FormName1TextBox, true); BATFeather.Wrappers().Frontend().Forms().FormsWrapper().VerifyIfFieldExistInPreviewMode(FormName1Checkbox, false); BATFeather.Wrappers().Frontend().Forms().FormsWrapper().VerifyIfFieldExistInPreviewMode(NextStep, true); BATFeather.Wrappers().Frontend().Forms().FormsWrapper().VerifyIfFieldExistInPreviewMode(Submit, false); ActiveBrowser.Close(); BAT.Wrappers().Backend().Forms().FormsContentScreen().PublishForm(); BAT.Macros().NavigateTo().Pages(this.Culture); BAT.Wrappers().Backend().Pages().PagesWrapper().OpenPageZoneEditor(PageName); BAT.Wrappers().Backend().Pages().PagesWrapper().PreviewPage(PageName, true); BATFeather.Wrappers().Frontend().Forms().FormsWrapper().VerifyNavigationPagesLabels(this.pagesDefaultLabels); BATFeather.Wrappers().Frontend().Forms().FormsWrapper().VerifyIfFieldExistInPreviewMode(FormName1TextBox, true); BATFeather.Wrappers().Frontend().Forms().FormsWrapper().VerifyIfFieldExistInPreviewMode(FormName1Checkbox, false); BATFeather.Wrappers().Frontend().Forms().FormsWrapper().VerifyIfFieldExistInPreviewMode(NextStep, true); BATFeather.Wrappers().Frontend().Forms().FormsWrapper().VerifyIfFieldExistInPreviewMode(Submit, false); ActiveBrowser.Close(); BAT.Wrappers().Backend().Pages().PageZoneEditorWrapper().PublishPage(); }
public void MyTestCleanup() { ActiveBrowser.Close(); #region WebAii CleanUp // Shuts down WebAii manager and closes all browsers currently running // after each test. This call is ignored if recycleBrowser is set this.CleanUp(); #endregion }
public void CloseBrowser_CodedStep() { int cnt = Manager.Browsers.Count(); //Console.WriteLine(cnt); //Console.ReadLine(); for (int i = 1; i < cnt; i++) { //ActiveBrowser.Window.Close(); Manager.Browsers[i].Close(); } ActiveBrowser.Close(); }
public void CommonBrowserMethods() { Manager.LaunchNewBrowser(); ActiveBrowser.NavigateTo(Path.Combine(TestContext.TestDeploymentDir, TESTPAGE)); // NOTE: // // The default settings for Browser.AutoDomRefresh & // Browser.AutoWaitUntilReady is True. This means that the Browser object // will wait for the browser to be ready after each action (AutoWaitUntilReady) // and will ensure that the Browser.DomTree is up to date after // each action on the page (AutoDomRefresh) by calling Browser.RefreshDomTree(). // The only exception to this are action performed using the Desktop object against // the browser. In this case, if these actions change the page DOM then you need // explicitly call Browser.WaitUntilReady() and Browser.RefreshDomTree() if needed too. // Get the element before any changes are made to the DOM. Element h1 = this.Elements.GetHtml("label"); Assert.IsTrue(h1.InnerText.Contains("EMPTY")); // Make sure the browser window has focus ActiveBrowser.Window.SetFocus(); // Invoke a hover over action using pure mouse move. Desktop.Mouse.HoverOver(h1.GetRectangle()); // Wait for the change to be complete. ActiveBrowser.WaitUntilReady(); // Refresh the DomTree with the latest changes. ActiveBrowser.RefreshDomTree(); // Update this Element object with the latest DOM changes. h1.Refresh(); Assert.IsTrue(h1.InnerText.Contains("FULL")); // Close this browser window. ActiveBrowser.Close(); }
public void closeBrowser_CodedStep() { ActiveBrowser.Close(); Log.WriteLine("Browser is closed now"); }
/// <summary> /// Close Browser /// <summary> public void CloseBrowserAndConfirmDialog() { var confirmDialog = BAT.Macros().DialogFacade().ConfirmDialog(); ActiveBrowser.Close(); }
/// <summary> /// Close Browser /// <summary> public void CloseBrowser() { ActiveBrowser.Close(); }