private void TDB_Shown(object sender, EventArgs e) { browser.GoTo("https://www.leboncoin.fr/"); if (browser.Div(Find.ByClass("clearfix")).Exists) { metroLabel2.Text = "Connecté"; } else { metroLabel2.Text = "En cours de connexion..."; browser.Button(Find.ByClass("button-white button-secondary popin-open trackable custom-small-hidden")).Click(); browser.ElementOfType <TextFieldExtended>(Find.ByName("st_username")).Value = "*****@*****.**"; browser.TextField(Find.ByName("st_passwd")).Value = "1999mbmb"; browser.Button(Find.ByValue("Se connecter")).Click(); browser.WaitForComplete(); if (browser.Div(Find.ByClass("create")).Exists) { metroLabel2.Text = "Connecté"; } else { metroLabel2.Text = "Impossible de se connecter"; } } }
public void UISendTest() { // create a new Internet Explorer instance pointing to the ASP.NET Development Server using (IE ie = new IE(Constants.DevWebSite + "send.aspx")) { // Maximize the IE window ie.ShowWindow(NativeMethods.WindowShowStyle.Maximize); // Fill in the form ie.SelectList(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_SenderDropDownList")).Select(Constants.Sender); ie.TextField(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_RecipientTextBox")).TypeText(Constants.Recipient); ie.TextField(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_MessageTextBox")).TypeText(MESSAGE); WatiN.Core.FileUpload fUp; fUp = ie.FileUpload(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_MultiUpload_Input_0")); fUp.Set(Constants.File0); fUp = ie.FileUpload(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_MultiUpload_Input_1")); fUp.Set(Constants.File1); fUp = ie.FileUpload(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_MultiUpload_Input_2")); fUp.Set(Constants.File2); ie.TextField(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_SecurityCodeTextBox")).TypeText(Constants.SecurityCode); //Trigger the key up event to execute the web service and allow some time for callback ie.TextField(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_SecurityCodeTextBox")).KeyUp(); System.Threading.Thread.Sleep(1000); //Click send and wait until end of post if (ie.Button(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_SendButton")).Enabled) { ie.Button(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_SendButton")).ClickNoWait(); SimpleTimer t = new SimpleTimer(60 * 60); Span s; do { s = ie.Span(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_FinalReportLabel")); if (s.Exists) { goto EXIT; } System.Threading.Thread.Sleep(1000); } while (!t.Elapsed); throw new WatiN.Core.Exceptions.TimeoutException(string.Format("waiting {0} seconds for element to show up.", 60 * 60)); EXIT: Div d = ie.Div(Find.ById("ctl00_PageContentPlaceHolder_QuickMessageControl_SendFinalPanel")); Assert.AreEqual(true, ((d.Exists) && (d.Links.Length > 0) && d.Links[0].Url.StartsWith(Constants.DevWebSite, StringComparison.InvariantCultureIgnoreCase))); } else { Assert.IsTrue(false, "Send button is disabled because of incorrect data"); } } }
private void Login(IE browser) { browser.WaitForComplete(); Thread.Sleep(1000); // MetroBank tries to load from Cookies, overwriting if we're too quick browser.TextField(Find.ById("USER_NAME")).Value = Config.Username; browser.Button(Find.ByTitle("Continue")).Click(); browser.TextField(Find.ById("LOGIN_PASSWORD")).Value = Config.Password; FillSecurityNumber(browser); browser.Button(Find.ByTitle("Log in")).Click(); browser.Button(Find.ByTitle("View my accounts")).Click(); }
static void Main(string[] args) { IE ie = new IE("http://192.168.0.1/pppoestatus.htm"); LogonDialogHandler dhdlLogon = new LogonDialogHandler("admin", "password"); ie.AddDialogHandler(dhdlLogon); ie.GoTo("http://192.168.0.1/pppoestatus.htm"); Console.WriteLine("Desconecto..."); ie.Button(Find.ByValue(" Disconnect ")).Click(); Thread.Sleep(10000); //ie.GoTo("http://192.168.0.1/pppoestatus.htm"); Console.WriteLine("Conecto..."); ie.Button(Find.ByValue(" Connect ")).Click(); ie.Dispose(); }
public static bool TestEmptyLogin(IE browser, string webPage, out string message) { bool result = true; message = ""; browser = new IE(); try { browser.GoTo(webPage); browser.Button(Find.ByClass("formbutton")).Click(); if (browser.Child(Find.ByClass("ErrorMessage")) == null) { message = "Error message not displayed"; return(false); } browser.GoTo(webPage); browser.Div(Find.ById(Login.ForgotPasswordAjaxMessageDiv)).NextSibling.NextSibling.Click(); Thread.Sleep(1000); if (browser.Div(Find.ById(Login.ForgotPasswordAjaxMessageDiv)).InnerHtml == null) { message = "Ajax error message not displayed"; return(false); } } finally { browser.Close(); } return(result); }
public void When_IPressTheButton(string buttonName) { Button button = Browser.Button(Find.ByValue(buttonName)); button.WaitUntilExists(2); button.Click(); }
public void LocatingThings() { using (var browser = new IE("http://www.pluralsight.com")) { //// Get a reference to a HTML input element, type=text, id=Name //TextField applicantName = browser.TextField(Find.ById("Name")); //// Get a reference to a HTML link element with id=HelpLink //Link helpHyperlink = browser.Link(Find.ById("HelpLink")); //// Get a reference to a HTML input element, type=submit, id=ApplyNow //Button applyButton = browser.Button(Find.ById("ApplyNow")); //// Get a reference to a HTML paragraph element, id=Name //Para nameParagraph = browser.Para(Find.ById("Name")); TextField applicantName = browser.TextField(Find.ById("Name")); Link helpHyperlink = browser.Link(Find.ById("HelpLink")); Button applyButton = browser.Button(Find.ById("ApplyNow")); Para nameParagraph = browser.Para(Find.ById("Name")); } }
public void TestMultipleIE() { using (var ie = new IE(TestEventsURI)) { var handler = new ConfirmDialogHandler(); try { ie.AddDialogHandler(handler); ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait(); handler.WaitUntilExists(5); handler.OKButton.Click(); } finally { ie.RemoveDialogHandler(handler); } using (var ie2 = new IE(TestEventsURI)) { var handler2 = new ConfirmDialogHandler(); try { ie2.AddDialogHandler(handler2); ie2.Button(Find.ByValue("Show confirm dialog")).ClickNoWait(); handler2.WaitUntilExists(5); handler2.OKButton.Click(); } finally { ie2.RemoveDialogHandler(handler2); } } } }
public static void LogIn(this IE browser) { browser.TextField(Find.ById("LoginId")).TypeText("employer0"); browser.TextField(Find.ById("Password")).TypeText("password"); browser.Button(Find.ById("login")).Click(); browser.WaitForComplete(); }
public static bool TestInexistantLogin(IE browser, string webPage, out string message) { bool result = true; message = ""; browser = new IE(); try { browser.GoTo(webPage); browser.TextField(Find.ById(Login.UsernameInputText)).TypeText("sssssss"); browser.TextField(Find.ById(Login.PasswordInputText)).TypeText("ppppppppp"); browser.Button(Find.ByClass("formbutton")).Click(); if (browser.Child(Find.ByClass("ErrorMessage")) == null) { message = "Error message not displayed"; return(false); } browser.GoTo(webPage); browser.TextField(Find.ById(Login.ForgotPasswordEmailInputText)).TypeText("*****@*****.**"); browser.Div(Find.ById(Login.ForgotPasswordAjaxMessageDiv)).NextSibling.NextSibling.Click(); Thread.Sleep(1000); if (browser.Div(Find.ById(Login.ForgotPasswordAjaxMessageDiv)).InnerHtml == null) { message = "Ajax error message not displayed"; return(false); } } finally { browser.Close(); } return(result); }
public void UpdateDocs(string docFolder) { string wikiurl = "http://www.cruisecontrolnet.org/projects/ccnet/wiki"; var stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); foreach (var wikiFile in FileName2ChiliPageNameMapping.Keys) { WriteToOutput(string.Format("updating page of {0}", wikiFile), OutputType.Info); var wikipage = FileName2ChiliPageNameMapping[wikiFile]; if (string.IsNullOrEmpty(FileName2ChiliPageNameMapping[wikiFile])) { WriteToOutput(string.Format(" {0} not mapped yet", wikiFile), OutputType.Warning); } else { var fullWikiFile = System.IO.Path.Combine(docFolder, wikiFile); if (!System.IO.File.Exists(fullWikiFile)) { WriteToOutput(string.Format(" {0} not found.", wikiFile), OutputType.Error); } else { string content = System.IO.File.ReadAllText(fullWikiFile); string editurl = string.Concat(wikiurl, "/", FileName2ChiliPageNameMapping[wikiFile], "/edit"); ie.GoTo(editurl); if (AtChiliCCNet()) { ie.TextField(WatiN.Core.Find.ById("content_text")).SetAttributeValue("value", content); ie.Button(WatiN.Core.Find.ByName("commit")).Click(); } else { WriteToOutput(string.Format(" page for {0} not found.", wikiFile), OutputType.Error); } } } } WriteToOutput("", OutputType.Info); WriteToOutput(string.Format("Total duration : {0} ms", stopwatch.ElapsedMilliseconds), OutputType.Info); stopwatch.Stop(); //string editurl = string.Concat(wikiurl, "/", wantedPage, "/edit"); //ie.GoTo(editurl); ////ie.TextField(WatiN.Core.Find.ById("content_text")).TypeText(content); //ie.TextField(WatiN.Core.Find.ById("content_text")).SetAttributeValue("value", content); //ie.Button(WatiN.Core.Find.ByName("commit")).Click(); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { //foreach (WatiN.Core.TextField obj in ie.TextFields) //{ // obj.Highlight(false); //} //foreach (WatiN.Core.Button obj in ie.Buttons) //{ // obj.Highlight(false); //} //foreach (WatiN.Core.Div obj in ie.Divs) //{ // obj.Highlight(false); //} txtSelect.Text = e.Node.Text; Div div = ie.Div(Find.ById(txtSelect.Text)); if (div != null && div.Exists) { div.Highlight(true); } TextField text = ie.TextField(Find.ByName(txtSelect.Text)); if (text != null && text.Exists) { text.Highlight(true); text.Select(); } WatiN.Core.Button butt = ie.Button(Find.ByValue(txtSelect.Text)); if (butt != null && butt.Exists) { butt.Highlight(true); } }
public void DoGoogleTest() { using (IE browser = new IE()) { browser.GoTo("www.google.co.uk"); Div logoDiv = browser.Div("hplogo"); Assert.IsTrue(logoDiv.Exists, "Logo div does not exist"); TextField searchText = browser.TextField("lst-ib"); Assert.IsTrue(searchText.Exists, "Search text field does not exist"); Button searchBtn = browser.Button(Find.ByName("btnK")); Assert.IsTrue(searchBtn.Exists, "Search button does not exist"); Button nonExistantButton = browser.Button("garbagegarbagegarbage"); // This will cause the test to fail because the link doesn't (shouldn't!) exist. // Comment it out and the test should pass Assert.IsTrue(nonExistantButton.Exists, "Non-existant button does not exist"); } }
public void Fluent_google_example() { using (var browser = new IE("www.google.com")) { browser.TextField(Where.Name.Equals("q")).TypeText("WatiN"); browser.Button(Where.Name.Equals("btnG")).Click(); } }
public ResultWindow(int timeLimit, string idProblem) : this() { this.timeLimit = timeLimit; this.idProblem = idProblem; Process process = new Process(); process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.StartInfo.FileName = "cmd"; process.StartInfo.Arguments = string.Format("/C \"\"{0}\" < \"{1}\" > \"{2}\"\"", Properties.Settings.Default.FileExec, Properties.Settings.Default.FileInput, Properties.Settings.Default.FileOutput); process.Start(); if (!process.WaitForExit(timeLimit * 1000)) { process.Kill(); } if (process.ExitCode != 0) { runtime.Visibility = Visibility.Visible; return; } timeExec.Content = process.TotalProcessorTime.Milliseconds / 1000f + "s"; try { textInput = File.ReadAllText(Properties.Settings.Default.FileInput); textOutput = File.ReadAllText(Properties.Settings.Default.FileOutput); textOutput = textOutput.Replace("\r\n", "\n"); //Settings.MakeNewIeInstanceVisible = false; WatiN.Core.Settings.Instance.AutoMoveMousePointerToTopLeft = false; browser = new IE(prefix + idProblem); TextField inputField = browser.TextField(Find.ById("edit-input-data")); WatiN.Core.Button buttonSubmit = browser.Button(Find.ById("edit-output")); inputField.Value = textInput; buttonSubmit.Click(); browser.WaitForComplete(); string result = browser.Html; int begin = result.IndexOf("<pre>") + 5; textCorrect = result.Substring(begin, result.IndexOf("</pre>") - begin); File.WriteAllText(Properties.Settings.Default.FileCorrect, textCorrect); if (textOutput != textCorrect) { incorrect.Visibility = Visibility.Visible; } else { accepted.Visibility = Visibility.Visible; } } catch (Exception exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } browser.ForceClose(); }
static void Test() { IE browser = null; browser = new IE("http://www.google.com"); browser.TextField(Find.ByName("q")).TypeText("WatiN"); browser.Button(Find.ByName("btnG")).Click(); browser.Close(); }
private void LogIn(IE browser) { browser.TextField(Find.ById("userid1")).Value = Config.Username; browser.Button(Find.ByTitle("Sign in")).Click(); FillInPasswordCharacters(browser); browser.TextField(Find.ById("memorableAnswer")).Value = Config.SecretAnswer; browser.Element(Find.ByTitle("Continue")).Click(); }
public void Should_add_three_visits() { new DatabaseTester().Clean(); var url = "http://localhost:1234/"; using (var ie = new IE(url)) { ie.Button("submit").Click(); Thread.Sleep(2000); ie.Button("submit").Click(); Thread.Sleep(2000); ie.Button("submit").Click(); Thread.Sleep(2000); ie.ElementsWithTag("hr").Count.ShouldEqual(3); } }
public void SpanByUrlTest() { GoTo("ConversationStates/SpanByUrl1.aspx"); IE.Button("btnStart").Click(); IE.Button("btCon").Click(); IE.Button("btnContinue").Click(); AssertTestSuccessMessageShown(); }
public void HelloWatin(string search) { using (var browser = new IE("http://www.google.com")) { browser.TextField(Find.ByName("q")).TypeText(search); browser.Button(Find.ByName("btnG")).Click(); Assert.IsTrue(browser.ContainsText(search)); } }
public void ClickMe() { IE ie = new IE("http://localhost/AnthemNxt.Tests/ButtonsAndLabels.aspx"); Assert.Null(ie.Span(Find.ById("ctl00_ContentPlaceHolder_label")).Text); ie.Button(Find.ByName("ctl00$ContentPlaceHolder$button")).Click(); Assert.NotEqual("", ie.Span(Find.ById("ctl00_ContentPlaceHolder_label")).Text); // TODO: Check no postback occurred - how can we do this? ie.Close(); }
public void Search_for_watin_on_google_the_old_way() { using (var browser = new IE("http://www.google.com")) { browser.TextField(Find.ByName("q")).TypeText("WatiN"); browser.Button(Find.ByName("btnG")).Click(); Assert.IsTrue(browser.ContainsText("WatiN")); } }
public void RunSmokeTest() { using (var browser = new IE("http://www.google.com")) { const string search = "WatiN"; browser.TextField(Find.ByName("q")).TypeText(search); browser.Button(Find.ByName("btnG")).Click(); Assert.IsTrue(browser.ContainsText(search)); } }
private static void LoginAsAdmin(IE netWindow) { //go to login page netWindow.GoTo("http://*****:*****@hotmail.com"); netWindow.TextField(Find.ById("ctl00_ContentPlaceHolder1_ucLogin_txtPassword")).TypeText(""); netWindow.Button(Find.ById("ctl00_ContentPlaceHolder1_ucLogin_btnLogin")).Click(); netWindow.WaitForComplete(100); }
public void Check_That_When_Logged_In_As_Admin_Then_Add_Product_Works() { var result = false; using (IE netWindow = new IE("http://localhost:49573/default.aspx")) { LoginAsAdmin(netWindow); netWindow.Link(Find.ById("ctl00_ucHeader_lnkAdminPage")).Click(); #region hidden new way netWindow.Link(Find.ById(new Regex("AdminPage$"))); #endregion netWindow.WaitForComplete(); netWindow.Button(Find.ById("ctl00_ucHeader_lnkProductAdmin")).Click(); netWindow.WaitForComplete(); netWindow.Button(Find.ById("ctl00_ContentPlaceHolder1_RadDock1_C_btnAddProduct")).Click(); netWindow.WaitForComplete(); netWindow.TextField(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_txtProductName")).TypeText(String.Format("Paul Test Product {0}", DateTime.Now.Ticks.ToString())); netWindow.SelectList(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ddlProductManufacturer")).SelectByValue("3"); netWindow.SelectList(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ddlCategoryList")).SelectByValue("2"); netWindow.WaitForComplete(100); netWindow.SelectList(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ddlSubCategoryList")).SelectByValue("2"); netWindow.WaitForComplete(); netWindow.Link(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_btnAddCombo")).Click(); netWindow.WaitForComplete(); netWindow.TextField(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_txtProductPrice")).TypeText("19.99"); netWindow.TextField(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_txtProductModel")).TypeText("Paul Test Model 1"); netWindow.Link(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_btnSave")).Click(); netWindow.WaitForComplete(); Span resultMessage = netWindow.Span(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ucMessage_lblMessage")); if (resultMessage.Text == "New Product created successfuly") { result = true; } } Assert.IsTrue(result); }
/// <summary> /// This method checks the browser for the specific field that you have specfied /// </summary> /// <param name="fieldType">The type of field that you are looking for (textbox/select/checkbox/button).</param> /// <param name="fieldId">The id of the field that you are looking for.</param> /// <returns>Boolean value indicating whether the field was found or not.</returns> public bool FieldExists(string fieldType, string fieldId) { switch (fieldType.ToLower()) { case "textbox": return(_browser.ElementOfType <TextFieldExtended>(Find.ById(fieldId)) != null); case "select": return(_browser.SelectList(Find.ById(fieldId)) != null); case "checkbox": return(_browser.CheckBox(Find.ById(fieldId)) != null); case "button": return(_browser.Button(Find.ById(fieldId)) != null); default: return(false); } }
public void UploadVideo(IE ie, string filePath) { ie.Link(Find.ById("uploadVideo")).Click(); var fu = ie.FileUpload(Find.ById("ctl00_cphAdmin_txtUploadVideo")); fu.Set(filePath); ie.Button(Find.ById("ctl00_cphAdmin_btnUploadVideo")).Click(); ie.WaitForComplete(); }
public void DoScreenshotTest() { Assert.IsNotNull(ie); using (TestLog.BeginSection("Go to Google, enter MbUnit as a search term and click I'm Feeling Lucky")) { ie.GoTo("http://www.google.com"); ie.TextField(Find.ByName("q")).TypeText("MbUnit"); ie.Button(Find.ByName("btnI")).Click(); } Assert.IsTrue(ie.ContainsText("NUnit"), "Expected to find NUnit on the page."); }
public void WhenISearchForAt_Info(string searchPhrase) { TextField txtSearchBox = WebBrowser.TextField("text"); txtSearchBox.TypeText(searchPhrase); Button btnSearch = WebBrowser.Button(Find.By("tabindex", "20")); btnSearch.Click(); СпиМояРадостьУсни(3000); }
public void TestCanLogin() { ie.GoTo("http://localhost:13164/Login.aspx"); TextField tf = ie.TextField(Find.ByName(t => t.EndsWith("$UserName"))); tf.TypeText("Alkampfer"); ie.TextField(Find.ByName(t => t.EndsWith("$Password"))).TypeText("12345"); ie.Button(Find.ByName(b => b.EndsWith("$LoginButton"))).Click(); //Navigate to the other page Assert.That(ie.Div("thecontent").Exists); }
public void CloseSpecificBrowserAlert() { Assert.AreEqual(0, Ie.DialogWatcher.Count, "DialogWatcher count should be zero"); var firstIE = Ie; firstIE.RunScript("document.title = 'firstIe'; "); using (var secondIe = new IE(TestPageUri,true)) { secondIe.RunScript("document.title = 'secondIe'; "); // set up a second browser with an open dialog var secondAlertDialogHandler = new AlertDialogHandler(); using (new UseDialogOnce(secondIe.DialogWatcher, secondAlertDialogHandler)) { secondIe.Button(Find.ByValue("Show alert dialog")).ClickNoWait(); secondAlertDialogHandler.WaitUntilExists(5); // close the original message var firstAlertDialogHandler = new AlertDialogHandler(); using (new UseDialogOnce(firstIE.DialogWatcher, firstAlertDialogHandler)) { firstIE.Button(Find.ByValue("Show alert dialog")).ClickNoWait(); firstAlertDialogHandler.WaitUntilExists(5); var message = firstAlertDialogHandler.Message; firstAlertDialogHandler.OKButton.Click(); firstIE.WaitForComplete(5); Assert.IsTrue(secondAlertDialogHandler.Exists(), "Original Alert Dialog should be open."); Assert.AreEqual("This is an alert!", message, "Unexpected message"); Assert.IsFalse(firstAlertDialogHandler.Exists(), "Alert Dialog should be closed."); } // close the second message secondAlertDialogHandler.OKButton.Click(); secondIe.WaitForComplete(5); Assert.IsFalse(secondAlertDialogHandler.Exists(), "Alert Dialog should be closed."); } } }
public void TestMultipleIEInstancesOpeningAlertDialogs() { using (var ie = new IE(TestEventsURI)) { var handler = new ConfirmDialogHandler(); using (new UseDialogOnce(ie.DialogWatcher, handler)) { ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait(); handler.WaitUntilExists(5); using (var ie2 = new IE(TestEventsURI)) { var handler2 = new ConfirmDialogHandler(); using (new UseDialogOnce(ie2.DialogWatcher, handler2)) { ie2.Button(Find.ByValue("Show confirm dialog")).ClickNoWait(); handler2.WaitUntilExists(5); handler2.OKButton.Click(); } } handler.OKButton.Click(); } } }
public void DialogWatcherOfIEAndHTMLDialogShouldNotBeNull() { using (var ie = new IE(MainURI)) { Assert.IsNotNull(ie.DialogWatcher, "ie.DialogWatcher should not be null"); ie.Button("modalid").ClickNoWait(); using (var htmlDialog = ie.HtmlDialog(Find.ByTitle("PopUpTest"))) { Assert.IsNotNull(htmlDialog.DialogWatcher, "htmlDialog.DialogWatcher should not be null"); } } }
public void HtmlDialogCollectionShouldReturnOnlyItsOwnChildHtmlDialogs() { Ie.Button("popupid").Click(); using (var ie2 = new IE(MainURI)) { ie2.Button("popupid").Click(); Assert.That(Ie.HtmlDialogs.Count, Is.EqualTo(1)); Assert.That(ie2.HtmlDialogs.Count, Is.EqualTo(1)); } }
public void DocumentShouldBeDisposedSoHTMLDialogGetsDisposedAndReferenceCountIsOK() { DialogWatcher dialogWatcher; int ReferenceCount; using (var ie = new IE(MainURI)) { ReferenceCount = ie.DialogWatcher.ReferenceCount; ie.Button("popupid").Click(); Thread.Sleep(100); using (Document document = ie.HtmlDialog(Find.ByIndex(0))) { Assert.AreEqual(ReferenceCount + 1, ie.DialogWatcher.ReferenceCount, "DialogWatcher reference count"); } dialogWatcher = ie.DialogWatcher; } Assert.AreEqual(ReferenceCount - 1, dialogWatcher.ReferenceCount, "DialogWatcher reference count should be zero after test"); }
public void TestWatiNWithInjectedHTMLCode() { var html = "<HTML><input name=txtSomething><input type=button name=btnSomething value=Click></HTML>"; using(var ie = new IE()) { var document = ((IEDocument)ie.NativeDocument).HtmlDocument; document.writeln(html); Assert.That(ie.Button(Find.ByName("btnSomething")).Exists); } }