public void SetText_OnHtmlEdit_Succeeds() { //Arrange using (var webPage = new TempWebPage( @"<html> <head> <title>test</title> </head> <body> <div id=""div1""> <input type=""text""/> </div> </body> </html>")) { var browserWindow = BrowserWindow.Launch(webPage.FilePath); HtmlDiv div = browserWindow.Find <HtmlDiv>(By.Id("div1")); HtmlEdit inputTextBox = div.Find <HtmlEdit>(); //Act inputTextBox.Text = "text"; //Assert Assert.AreEqual("text", inputTextBox.Text); browserWindow.Close(); } }
public void SetText_OnHtmlEdit_Succeeds() { //Arrange using (TempFile tempFile = new TempFile( @"<html> <head> <title>test</title> </head> <body> <div id=""div1""> <input type=""text""/> </div> </body> </html>")) { BrowserWindow.Launch(tempFile.FilePath); var window = new BrowserWindowUnderTest("test"); HtmlDiv div = window.Find <HtmlDiv>(By.Id("div1")); HtmlEdit inputTextBox = div.Find <HtmlEdit>(); //Act inputTextBox.Text = "text"; //Assert Assert.AreEqual("text", inputTextBox.Text); window.Close(); } }
private HtmlControl CheckValidationMessage() { HtmlDiv searchscopeButton = new HtmlDiv(_bw); searchscopeButton.SearchProperties.Add(HtmlDiv.PropertyNames.Class, "validation-summary-errors text-danger"); searchscopeButton.Find(); HtmlControl text = new HtmlControl(searchscopeButton); text.SearchProperties.Add(HtmlTextArea.PropertyNames.InnerText, "Invalid login attempt."); return(text); }
public MainObjects CheckLogin(string username) { HtmlDiv searchscopeButton = new HtmlDiv(_bw); searchscopeButton.SearchProperties.Add(HtmlDiv.PropertyNames.Class, "navbar-right"); searchscopeButton.Find(); HtmlControl text = new HtmlControl(searchscopeButton); text.SearchProperties.Add(HtmlTextArea.PropertyNames.InnerText, "Hello " + username + "!"); text.Find(); return(this); }
private HtmlInputButton GetLoginButton() { HtmlDiv searchscopeButton = new HtmlDiv(_bw); searchscopeButton.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "login-button"); searchscopeButton.Find(); HtmlInputButton btn = new HtmlInputButton(searchscopeButton); btn.SearchProperties.Add(HtmlButton.PropertyNames.Type, "submit"); btn.SearchProperties.Add(HtmlButton.PropertyNames.ValueAttribute, "Log in"); return(btn); }
public MainObjects Logout() { HtmlDiv searchscopeButton = new HtmlDiv(_bw); searchscopeButton.SearchProperties.Add(HtmlDiv.PropertyNames.Class, "navbar-right"); searchscopeButton.Find(); HtmlHyperlink btn = new HtmlHyperlink(searchscopeButton); btn.SearchProperties.Add(HtmlTextArea.PropertyNames.Id, "helloLink"); Mouse.Click(btn); HtmlHyperlink btn2 = new HtmlHyperlink(searchscopeButton); btn2.SearchProperties.Add(HtmlHyperlink.PropertyNames.Id, "logoutLink"); Mouse.Click(btn2); return(this); }