本文整理匯總了C#中WatiN.Core.IE.Element方法的典型用法代碼示例。如果您正苦於以下問題:C# IE.Element方法的具體用法?C# IE.Element怎麽用?C# IE.Element使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WatiN.Core.IE
的用法示例。
在下文中一共展示了IE.Element方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: UnsuccessfulAdministrationLogin
public void UnsuccessfulAdministrationLogin()
{
bool result;
using (var browser = new IE("http://localhost:1200/"))
{
browser.Link(Find.ByText("Admin")).Click();
browser.TextField(Find.ById("UserName")).TypeText("admin");
browser.TextField(Find.ById("Password")).TypeText("admin");
browser.Element(Find.ByValue("Log On")).Click();
result = browser.ContainsText("Login was unsuccessful.");
}
Assert.That(result, "Browser Url is incorrect");
}
示例2: SuccessfulAdministrationLogin
public void SuccessfulAdministrationLogin()
{
var browserUrl = string.Empty;
using (var browser = new IE("http://localhost:1200/"))
{
browser.Link(Find.ByText("Admin")).Click();
browser.TextField(Find.ById("UserName")).TypeText("administrator");
browser.TextField(Find.ById("Password")).TypeText("password123!");
browser.Element(Find.ByValue("Log On")).Click();
browser.WaitForComplete(2);
browserUrl = browser.Url;
}
Assert.That(browserUrl.Contains("/StoreManager"), string.Format("Browser Url is incorrect - it is actually {0}", browserUrl));
}
示例3: Login_Successful_Should_Have_LogOut_Link
public void Login_Successful_Should_Have_LogOut_Link()
{
using (var browser = new IE())
{
browser.GoTo("http://localhost:1100/");
browser.BringToFront();
browser.Link(Find.ByText("Admin")).Click();
//browser.Element(x => x.)
browser.TextField(Find.ById("UserName")).TypeText("administrator");
browser.TextField(Find.ById("Password")).TypeText("password123!");
browser.Element(Find.BySelector("input.LogOn")).Click();
Assert.IsTrue(browser.Link(Find.ByText("Log Out")).Exists);
browser.Link(Find.ByText("Log Out")).Click();
}
}
示例4: Login_UnSuccessful_Should_Have_Error
public void Login_UnSuccessful_Should_Have_Error()
{
var browser = new IE();
browser.GoTo("http://localhost:1100/");
browser.BringToFront();
browser.Link(Find.ByText("Admin")).Click();
browser.TextField(Find.ById("UserName")).TypeText("admin");
browser.TextField(Find.ById("Password")).TypeText("1234");
browser.Element(Find.BySelector("input.LogOn")).Click();
Assert.IsTrue(browser.ContainsText("Login was unsuccessful."));
}
示例5: Login_WithoutUsernameAndPassword_Should_Have_ErrorMessage
public void Login_WithoutUsernameAndPassword_Should_Have_ErrorMessage()
{
using (var browser = new IE())
{
browser.GoTo("http://localhost:1100/");
browser.BringToFront();
browser.Link(Find.ByText("Admin")).Click();
browser.Element(Find.BySelector("input.LogOn")).Click();
Assert.IsTrue(browser.ContainsText("The User name field is required"));
Assert.IsTrue(browser.ContainsText("The Password field is required."));
}
}
示例6: PassportCheck
public string PassportCheck()
{
string strreturn = "";
using (var browser = new IE("https://www.world-check.com/portal/mod_perl/Login/"))
{
if (Find.ByName("username"))
{
browser.TextField(Find.ByName("username")).TypeText("nzrbrt0002");
browser.TextField(Find.ByName("password")).TypeText("Go8ahE5s");
browser.Image(Find.ByName("submitted")).Click();
}
browser.GoTo("https://www.world-check.com/portal/mod_perl/PassportCheck");
browser.TextField(Find.ByName("givenName")).TypeText("Jim");
browser.TextField(Find.ByName("lastName")).TypeText("Smith");
browser.RadioButton(Find.ByName("sexg") && Find.ByValue("M")).Click();
browser.Span(Find.ById("issuingState-CAN")).Click();
browser.TextField(Find.ByName("dateOfBirthDay")).TypeText("29");
browser.TextField(Find.ByName("dateOfBirthMonth")).TypeText("05");
browser.TextField(Find.ByName("dateOfBirthYear")).TypeText("1978");
browser.TextField(Find.ByName("passportNumber")).TypeText("WL745488");
browser.TextField(Find.ByName("expireDateDay")).TypeText("10");
browser.TextField(Find.ByName("expireDateMonth")).TypeText("07");
browser.TextField(Find.ByName("expireDateYear")).TypeText("2014");
browser.Button(Find.ByValue("VERIFY")).Click();
var element = browser.Element(Find.ByClass("tablelinespacer"));
var firsttd = element.NextSibling.NextSibling;
strreturn = firsttd.Text.Replace("Lower Line:","");
//Assert.IsTrue(browser.ContainsText("WatiN"));
}
return strreturn;
}