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 ShouldShowCorrectApplicantDetailsOnSuccessPage() { using (var browser = new IE("http://localhost:62727/Pages/ApplyForCreditCard.aspx")) { // Leave the browser open after the test completes // to see what's happened for demo purposes browser.AutoClose = false; browser.TextField(Find.ById("Name")).TypeText("Jason"); browser.TextField(Find.ById("Age")).TypeText("30"); browser.TextField(Find.ById("AirlineRewardNumber")).TypeText("A1234567"); browser.Button(Find.ById("ApplyNow")).Click(); var name = browser.Para(Find.ById("Name")).Text; Assert.That(name, Is.EqualTo("Jason")); } }