本文整理匯總了C#中WatiN.Core.IE.Image方法的典型用法代碼示例。如果您正苦於以下問題:C# IE.Image方法的具體用法?C# IE.Image怎麽用?C# IE.Image使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WatiN.Core.IE
的用法示例。
在下文中一共展示了IE.Image方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Login
private void Login(ref IE ie)
{
Utilities.NavigateToHomePage(ref ie);
if (ie.Url.Contains("Login"))
{
ie.GoTo(Utilities.GetUrl("Index.aspx"));
string UserName = ConfigurationReader.getWebUserName();
string Password = ConfigurationReader.getWebPassword();
ie.TextField(Find.ById("txtUsername")).TypeText(UserName);
ie.TextField(Find.ById("txtPassword")).TypeText(Password);
ie.Image(Find.ById("IbLogin")).ClickNoWait();
}
}
示例2: GetImage
public static WatiN.Core.Image GetImage(IE ie, HControl control)
{
switch (control.Attribute.ToLower())
{
case AttributeType.Id:
{
Image txt = ie.Image(Find.ById(control.Value));
if (txt.Exists)
return txt;
return null;
}
case AttributeType.Name:
{
Image txt = ie.Image(Find.ByName(control.Value));
if (txt.Exists)
return txt;
return null;
}
case AttributeType.Class:
{
Image txt = ie.Image(Find.ByClass(control.Value));
if (txt.Exists)
return txt;
return null;
}
case AttributeType.Text:
{
Image txt = ie.Image(Find.ByText(control.Value));
if (txt.Exists)
return txt;
return null;
}
case AttributeType.Value:
{
Image txt = ie.Image(Find.ByValue(control.Value));
if (txt.Exists)
return txt;
return null;
}
default:
{
Image txt = ie.Image(Find.ByName(control.Value));
if (txt.Exists)
return txt;
return null;
}
}
}
示例3: FindControlInBrowserByID
public static object FindControlInBrowserByID(IE ie, string strID, Enumerators.ControlType ctrl)
{
if (ctrl == Enumerators.ControlType.Span)
{
Span sp = ie.Span(Find.ById(strID));
Assert.IsTrue(sp.Exists, "Could not Find: " + strID);
return sp;
}
else if (ctrl == Enumerators.ControlType.Link)
{
Link lnk = ie.Link(Find.ById(strID));
Assert.IsTrue(lnk.Exists, "Could not Find: " + strID);
return lnk;
}
else if (ctrl == Enumerators.ControlType.Frame)
{
Frame iFrame = ie.Frame(Find.ById(strID));
return iFrame;
}
else if (ctrl == Enumerators.ControlType.Image)
{
Image img = ie.Image(Find.ById(strID));
Assert.IsTrue(img.Exists, "Could not Find: " + strID);
return img;
}
else if (ctrl == Enumerators.ControlType.TableCell)
{
TableCell tCell = ie.TableCell(Find.ById(strID));
Assert.IsTrue(tCell.Exists, "Could not Find: " + strID);
return tCell;
}
else if (ctrl == Enumerators.ControlType.Table)
{
Table tbl = ie.Table(Find.ById(strID));
Assert.IsTrue(tbl.Exists, "Could not Find: " + strID);
return tbl;
}
else if (ctrl == Enumerators.ControlType.TableRow)
{
TableRow row = ie.TableRow(Find.ById(strID));
Assert.IsTrue(row.Exists, "Could not Find: " + strID);
return row;
}
else if (ctrl == Enumerators.ControlType.CheckBox)
{
CheckBox chk = ie.CheckBox(Find.ById(strID));
Assert.IsTrue(chk.Exists, "Could not Find: " + strID);
return chk;
}
else if (ctrl == Enumerators.ControlType.Button)
{
Button btn = ie.Button(Find.ById(strID));
Assert.IsTrue(btn.Exists, "Could not Find: " + strID);
return btn;
}
else if (ctrl == Enumerators.ControlType.TextField)
{
TextField txt = ie.TextField(Find.ById(strID));
Assert.IsTrue(txt.Exists, "Could not Find: " + strID);
return txt;
}
else if (ctrl == Enumerators.ControlType.SelectList)
{
SelectList sList = ie.SelectList(Find.ById(strID));
Assert.IsTrue(sList.Exists, "Could not Find: " + strID);
return sList;
}
else if (ctrl == Enumerators.ControlType.Div)
{
Div division = ie.Div(Find.ById(strID));
Assert.IsTrue(division.Exists, "Could not Find: " + strID);
return division;
}
else if (ctrl == Enumerators.ControlType.TableRow)
{
TableRow tRow = ie.TableRow(Find.ById(strID));
Assert.IsTrue(tRow.Exists, "Could not Find: " + strID);
return tRow;
}
else if (ctrl == Enumerators.ControlType.FileUpload)
{
FileUpload fileUpload = ie.FileUpload(Find.ById(strID));
Assert.IsTrue(fileUpload.Exists, "Could not find: " + strID);
return fileUpload;
}
else
{
return null;
}
}
示例4: FindControlInBrowserByCustom
public static object FindControlInBrowserByCustom(IE ie, string strCustomAttribute, string strToFind,
Enumerators.ControlType ctrl)
{
if (ctrl == Enumerators.ControlType.Span)
{
Span sp = ie.Span(Find.By(strCustomAttribute, strToFind));
Assert.IsTrue(sp.Exists, "Could not Find: " + strToFind);
return sp;
}
else if (ctrl == Enumerators.ControlType.Link)
{
Link lnk = ie.Link(Find.By(strCustomAttribute, strToFind));
Assert.IsTrue(lnk.Exists, "Could not Find: " + strToFind);
return lnk;
}
else if (ctrl == Enumerators.ControlType.Frame)
{
Frame frame = ie.Frame(Find.By(strCustomAttribute, strToFind));
Assert.AreEqual(frame.Name, strToFind);
return frame;
}
else if (ctrl == Enumerators.ControlType.Image)
{
Image img;
if (strCustomAttribute == "src")
{
img = ie.Image(Find.BySrc(strToFind));
}
else
{
img = ie.Image(Find.By(strCustomAttribute, strToFind));
}
Assert.IsTrue(img.Exists, "Could not Find: " + strToFind);
return img;
}
else if (ctrl == Enumerators.ControlType.TableCell)
{
TableCell tCell = ie.TableCell(Find.By(strCustomAttribute, strToFind));
Assert.IsTrue(tCell.Exists, "Could not Find: " + strToFind);
return tCell;
}
else if (ctrl == Enumerators.ControlType.Table)
{
Table tbl = ie.Table(Find.By(strCustomAttribute, strToFind));
Assert.IsTrue(tbl.Exists, "Could not Find: " + strToFind);
return tbl;
}
else if (ctrl == Enumerators.ControlType.TableRow)
{
TableRow row = ie.TableRow(Find.By(strCustomAttribute, strToFind));
Assert.IsTrue(row.Exists, "Could not Find: " + strToFind);
return row;
}
else if (ctrl == Enumerators.ControlType.CheckBox)
{
CheckBox chk = ie.CheckBox(Find.By(strCustomAttribute, strToFind));
Assert.IsTrue(chk.Exists, "Could not Find: " + strToFind);
return chk;
}
else if (ctrl == Enumerators.ControlType.Button)
{
Button btn = ie.Button(Find.By(strCustomAttribute, strToFind));
Assert.IsTrue(btn.Exists, "Could not Find: " + strToFind);
return btn;
}
else if (ctrl == Enumerators.ControlType.TextField)
{
TextField txt = ie.TextField(Find.By(strCustomAttribute, strToFind));
Assert.IsTrue(txt.Exists, "Could not Find: " + strToFind);
return txt;
}
else if (ctrl == Enumerators.ControlType.SelectList)
{
SelectList sList = ie.SelectList(Find.By(strCustomAttribute, strToFind));
Assert.IsTrue(sList.Exists, "Could not Find: " + strToFind);
return sList;
}
else if (ctrl == Enumerators.ControlType.Div)
{
Div div = ie.Div(Find.By(strCustomAttribute, strToFind));
Assert.IsTrue(div.Exists, "Could not Find: " + strToFind);
return div;
}
else
{
return null;
}
}
示例5: 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;
}