本文整理匯總了C#中WatiN.Core.IE.SelectList方法的典型用法代碼示例。如果您正苦於以下問題:C# IE.SelectList方法的具體用法?C# IE.SelectList怎麽用?C# IE.SelectList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WatiN.Core.IE
的用法示例。
在下文中一共展示了IE.SelectList方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Check_That_When_Logged_In_As_Admin_Then_Add_Product_Works
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);
}
開發者ID:stack72,項目名稱:SpecFlow-Demo-Project-with-MVC-Music-Store,代碼行數:42,代碼來源:SampleTestsforWebforms.cs
示例2: PureWatiNTest
public void PureWatiNTest()
{
IE ie = new IE(@"http://ostermiller.org/calc/tictactoe.html");
ie.SelectList(Find.ByName("p1")).Select("Human");
ie.SelectList(Find.ByName("p2")).Select("Human");
ie.Button(Find.ByValue(@"New Game")).Click();
ie.Button(Find.ByValue(@"Clear Stats")).Click();
ie.Button(Find.ByName("c9")).Click();
ie.Button(Find.ByName("c8")).Click();
ie.Button(Find.ByName("c5")).Click();
ie.Button(Find.ByName("c6")).Click();
ie.Button(Find.ByName("c1")).Click();
var btnPlayerXStats = ie.Button(Find.ByName("xWon"));
Assert.AreEqual("1", btnPlayerXStats.Value);
}
示例3: FilterByCategory
public void FilterByCategory()
{
using (var ie = new IE("http://dc2011.localhost/Project List.aspx"))
{
var articles = ie.List(list => list.Parent.ClassName == "list");
var count = articles.Children().Count;
ie.SelectList(list => list.Parent.ClassName == "filter").Select("Date Code");
ie.Button(button => button.Parent.ClassName == "buttons").Click();
articles.Refresh();
var filterCount = articles.Children().Count;
Assert.Less(filterCount, count);
}
}
示例4: LocatingThingsByNonId
public void LocatingThingsByNonId()
{
using (var browser =
new IE("http://localhost:62727/Pages/ApplyForCreditCard.aspx"))
{
Div errorContainer = browser.Div(Find.ByClass("error"));
SelectList title = browser.SelectList(Find.ByName("Title"));
Label ageLabel = browser.Label(Find.ByFor("Age"));
TextField applicantAge = browser.TextField(Find.ByLabelText("Age In Years"));
TextField applicantAge2 = browser.TextField(Find.By("id", "Age"));
// var something = browser.Div(Find.By("someattribute","somevalue"));
// Assert.That(something, Is.Not.Null);
// Link helpHyperlink = browser.Link(Find.ById("HelpLink"));
// Button applyButton = browser.Button(Find.ById("ApplyNow"));
// Para nameParagraph = browser.Para(Find.ById("Name"));
}
}
示例5: InteractingWithElement
public void InteractingWithElement()
{
using (var browser =
new IE("http://localhost:62727/Pages/ApplyForCreditCard.aspx"))
{
browser.AutoClose = false;
browser.ShowWindow(NativeMethods.WindowShowStyle.Minimize);
browser.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
TextField applicantName = browser.TextField(Find.ById("Name"));
applicantName.TypeText("Jason Roberts");
Link helpHyperlink = browser.Link(Find.ById("HelpLink"));
helpHyperlink.Click();
SelectList title = browser.SelectList(Find.ById("Title"));
title.Select("Prof");
title.SelectByValue("4");
Button applyButton = browser.Button(Find.ById("ApplyNow"));
applyButton.Click();
}
}
示例6: Descargar
public static void Descargar(string rfc, string contrasena, string carpeta, DateTime fechaDesde, DateTime fechaHasta, TipoBusqueda busqueda)
{
using (IE browser = new IE())
{
//limpiar sesion y login
browser.ClearCookies();
Thread.Sleep(1000);
//java login
browser.GoTo("https://portalcfdi.facturaelectronica.sat.gob.mx");
browser.WaitForComplete();
//entrar por contraseña
browser.GoTo("https://cfdiau.sat.gob.mx/nidp/app/login?id=SATUPCFDiCon&sid=0&option=credential&sid=0");
browser.TextField(Find.ByName("Ecom_User_ID")).AppendText(rfc);
browser.TextField(Find.ByName("Ecom_Password")).AppendText(contrasena);
browser.Button("submit").Click();
browser.WaitForComplete();
//ver si nos pudimos loggear
if (browser.ContainsText("Login failed, please try again") || browser.ContainsText("La entrada no se ha completado"))
{
browser.Close();
throw new Exception("Los datos de acceso son incorrectos para: " + rfc);
}
//seleccionar emitidas o recibidas
if (busqueda == TipoBusqueda.Emitidas)
{
browser.RadioButton("ctl00_MainContent_RdoTipoBusquedaEmisor").Click();
}
else
{
browser.RadioButton("ctl00_MainContent_RdoTipoBusquedaReceptor").Click();
}
browser.Button("ctl00_MainContent_BtnBusqueda").Click();
Log.Write("Tipo busqueda", Log.Information);
//Creating the directory if it doesn't exists
if (!System.IO.Directory.Exists(carpeta))
{
System.IO.Directory.CreateDirectory(carpeta);
}
//facturas emitidas
if (busqueda == TipoBusqueda.Emitidas)
{
browser.WaitUntilContainsText("Fecha Inicial de Emisión");
browser.RadioButton("ctl00_MainContent_RdoFechas").Click();
Thread.Sleep(1000);
//fecha desde
browser.TextField("ctl00_MainContent_CldFechaInicial2_Calendario_text").Value = fechaDesde.ToString("dd/MM/yyyy");
//hasta
browser.TextField("ctl00_MainContent_CldFechaFinal2_Calendario_text").Value = fechaHasta.ToString("dd/MM/yyyy");
Thread.Sleep(1000);
//buscar muchas veces por si marca error de lentitud la pagina del sat >(
while (true)
{
browser.Button("ctl00_MainContent_BtnBusqueda").Click();
Thread.Sleep(3000);
if (browser.ContainsText("lentitud"))
{
browser.Link("closeBtn").Click();
}
else
{
break;
}
}
DescargarFacturasListadas(browser, carpeta);
}
else
{
DateTime mesActual = fechaDesde;
bool primeraVez = true;
while (mesActual < fechaHasta)
{
browser.WaitUntilContainsText("Fecha de Emisión");
browser.RadioButton("ctl00_MainContent_RdoFechas").Click();
Thread.Sleep(1000);
//seleccionar año adecuado
browser.SelectList("DdlAnio").SelectByValue(mesActual.Year.ToString());
//seleccionar mes adecuado
browser.SelectList("ctl00_MainContent_CldFecha_DdlMes").SelectByValue(mesActual.Month.ToString());
if (mesActual.Day < 10 && primeraVez)
{
//seleccionar dia adecuado
//click en buscar por que si no no jala
//buscar muchas veces por si marca error de lentitud la pagina del sat >(
//.........這裏部分代碼省略.........
示例7: FetchLeetCode
public void FetchLeetCode()
{
using (var browser = new IE("https://leetcode.com"))
{
using (StreamReader sr = new StreamReader(Directory + @"template\solution.html"))
{
string solutionTemplate = sr.ReadToEnd();
using (StreamReader questionReader = new StreamReader(Directory + @"template\question.html"))
{
string questionTemplate = questionReader.ReadToEnd();
var toHtml = new IE("http://hilite.me/");
browser.Link(Find.ByClass("btn btn-default")).Click();
browser.TextField(Find.ById("id_login")).SetAttributeValue("value", "[email protected]"); //TypeText("[email protected]");
browser.TextField(Find.ById("id_password")).SetAttributeValue("value", "Test123"); //.TypeText("Test123");
browser.Button(Find.ByText("Sign In")).Click();
for (int i = 115; i < 300; ++i)
{
var table = browser.Table(Find.ById("problemList"));
var body = table.TableBodies[0];
foreach (var row in body.OwnTableRows)
{
if (row.Elements != null && row.Elements.Count > 0 && "ac" == row.Elements[1].ClassName)
{
var cell2 = row.Elements[2] as TableCell;
string questionIndex = cell2.Text;
if (Int32.Parse(questionIndex) == i)
{
var cell = row.Elements[3] as TableCell;
string questionName = cell.Text;
cell.Links[0].Click();
var questionDiv = browser.Div(Find.ByClass("question-content"));
string questionContent = "";
for (int j = 0; j < questionDiv.Paras.Count; ++j)
{
if (!string.IsNullOrEmpty(questionDiv.Paras[j].Text) &&
questionDiv.Paras[j].Text.StartsWith("<b>Notes:</b>"))
{
break;
}
questionContent += "<p>" + questionDiv.Paras[j].Text + "</p>";
}
//browser.Links.SelectMany(l => l.Text == "My Submissions");
browser.Links.Filter(l => l.Text == "My Submissions").Where(l => l.Url != "https://leetcode.com/submissions/").First().Click();
//browser.Link(Find.ByText("My Submissions") ). .Click();
browser.WaitForComplete();
var tableResult = browser.Table(Find.ById("result_testcases"));
var resultBody = tableResult.TableBodies[0];
string solutionCode = "";
foreach (var resultRow in resultBody.OwnTableRows)
{
if (resultRow.Elements[3].Text.Contains("Accepted"))
{
var acceptedCell = resultRow.Elements[3] as TableCell;
acceptedCell.Links[0].Click();
var div = browser.Div(Find.ByClass("ace_content"));
solutionCode = div.Text;
solutionCode = solutionCode.Replace("\r\n\r\n", "\r\n");
break;
}
}
toHtml.TextField(Find.ById("divstyles")).SetAttributeValue("value", "padding:.1em .3em;");
toHtml.TextField(Find.ByName("code")).SetAttributeValue("value", solutionCode);
toHtml.SelectList(Find.ByName("lexer")).SelectByValue("cpp");
toHtml.Button(Find.ByValue("Highlight!")).Click();
toHtml.WaitForComplete(3);
string questionhtml = questionTemplate.Replace("<%QuestionName%>", questionName).Replace("<%QuestionContent%>", questionContent);
string solutonhtml = solutionTemplate.Replace("<%QuestionName%>", questionName).Replace("<%SolutionTemplate%>", toHtml.TextField(Find.ById("html")).Text);
solutonhtml = solutonhtml.Replace("margin: 0; line-height: 125%", "margin: 0; line-height: 125%; white-space: pre-wrap;");
string solutionFilename = Directory + "output\\" + questionIndex + ".solution.html";
string questionFileName = Directory + "output\\" + questionIndex + ".question.html";
System.IO.File.WriteAllText(solutionFilename, solutonhtml);
System.IO.File.WriteAllText(questionFileName, questionhtml);
browser.GoTo("https://leetcode.com/problemset/algorithms/");
}
}
}
//.........這裏部分代碼省略.........
示例8: RunPageTest
private static void RunPageTest(TestSettings settings)
{
string url;
using (var browser = new IE(ConfigurationManager.AppSettings["WebpageTestUrl"]))
{
browser.TextField(Find.ById("url")).Value = settings.Url;
if (!string.IsNullOrEmpty(settings.TestLocation))
browser.SelectList(Find.ById("location")).SelectByValue(settings.TestLocation);
if (!string.IsNullOrEmpty(settings.Browser))
browser.SelectList(Find.ById("browser")).SelectByValue(settings.Browser);
browser.Link(Find.ById("advanced_settings")).ClickNoWait();
if (!string.IsNullOrEmpty(settings.Speed))
browser.SelectList(Find.ById("connection")).SelectByValue(settings.Speed);
if (settings.IsPrivate)
browser.CheckBox(Find.ById("keep_test_private")).Change();
if (!string.IsNullOrEmpty(settings.Username))
browser.TextField(Find.ById("username")).TypeText(settings.Username);
if (!string.IsNullOrEmpty(settings.Password))
browser.TextField(Find.ById("password")).TypeText(settings.Password);
browser.Button(Find.ByName("submit")).Click();
browser.WaitUntilContainsText("First View", settings.Timeout);
if (browser.ContainsText("partially complete"))
{
Thread.Sleep(10000);
browser.Refresh();
}
browser.WaitUntilContainsText("Raw page data", settings.Timeout);
url = browser.Link(Find.ByText("Raw page data")).Url;
}
var csvRequest = (HttpWebRequest) WebRequest.Create(url);
csvRequest.Accept = "text/csv";
var data = new List<PageData>();
using (var stream = csvRequest.GetResponse().GetResponseStream())
{
if (stream != null)
{
using (var reader = new StreamReader(stream))
{
using (var context = new CsvReader(reader))
{
while (context.Read())
{
var counter = data.Count;
var item = new PageData();
item.EventName = counter == 0 ? "Empty Cache" : "Cached Run " + counter;
item.Url = context.GetField<string>(3);
item.LoadTime = TimeSpan.FromMilliseconds(context.GetField<int>(4));
item.TimeToFirstByte = TimeSpan.FromMilliseconds(context.GetField<int>(5));
item.Requests = context.GetField<int>(11);
data.Add(item);
}
}
}
}
}
var host = ConfigurationManager.AppSettings["MetricTracking:Host"];
var port = int.Parse(ConfigurationManager.AppSettings["MetricTracking:Port"]);
using (var metric = new MetricTracker(host, port))
{
foreach (var run in data)
{
Console.WriteLine(run.EventName + "\t" + run.LoadTime);
var prefix = settings.Prefix + run.EventName.Replace(" ", string.Empty) + ".";
metric.Timing(prefix + "LoadTime", run.LoadTime.TotalMilliseconds);
metric.Timing(prefix + "TimeToFirstByte", run.TimeToFirstByte.TotalMilliseconds);
metric.Value(prefix + "Requests", run.Requests);
}
}
}
示例9: GetPatentsInYear
private static void GetPatentsInYear(int year)
{
using (var browser = new IE(resource))
{
// go to the search form
browser.Button(Find.ByName("menu")).ClickNoWait();
// fill out search form and submit
browser.CheckBox(Find.ByName("brugsmodel")).Click();
browser.SelectList(Find.ByName("datotype")).Select("Patent/reg. dato");
browser.TextField(Find.ByName("dato")).Value = string.Format("{0}*", year);
browser.Button(Find.By("type", "submit")).ClickNoWait();
browser.WaitForComplete();
// go to first patent found in search result and save it
browser.Buttons.Filter(Find.ByValue("Vis")).First().Click();
GetPatentFromPage(browser, year);
// hit the 'next' button until it's no longer there
while (GetNextPatentButton(browser).Exists)
{
GetNextPatentButton(browser).Click();
GetPatentFromPage(browser, year);
}
}
}
示例10: Main
static void Main(string[] args)
{
AES aes = new AES();
//grab from the appSettings
string username = AES.Decrypt(ConfigurationManager.AppSettings["username"]);
string password = AES.Decrypt(ConfigurationManager.AppSettings["password"]);
string shoreTelDirectorLogin = AES.Decrypt(ConfigurationManager.AppSettings["ShoreTelDirectorLogin"]);
string shoreTelUserList = AES.Decrypt(ConfigurationManager.AppSettings["ShoreTelUserList"]);
//nav to url
IE myIE = new IE(shoreTelDirectorLogin);
//sign in
myIE.TextField(Find.ByName("login")).TypeText(username);
myIE.TextField(Find.ByName("password")).TypeText(password);
myIE.Button(Find.ByName("SUBMIT1")).Click();
//nav to url containing userList
IE myIE3 = new IE(shoreTelUserList);
//change recPerPage to 3000 to ensure we grab all extensions
myIE3.SelectList(Find.ById("RecPerPage")).Option("3000").Select();
var userListTable = myIE3.Table(Find.By("_t", "Users"));
//create/overwrite javascript file
string jspath = @"C:\SendShoreTelUsersHome.js";
File.Create(jspath).Close();
StreamWriter sw = new StreamWriter(jspath);
//Prepare the ports!
sw.WriteLine("var ports = new ActiveXObject('ShoreBusDS.Ports');");
//writing go home line for each extension
foreach (var tableRow in userListTable.TableRows)
{
//sample text layout of each tr.Text: " Zac Glenn Headquarters Executives Personal 7777 7777 AB77 77 Zac Glenn Home "
if (!string.IsNullOrEmpty(tableRow.Text))
{
Match match = Regex.Match(tableRow.Text, @"\d{4}");
string extension = match.Value;
if (!string.IsNullOrEmpty(extension))
{
sw.WriteLine("ports.UserGoHome('" + extension + "');");
}
}
}
//close file connection because exceptions arise that the file is already in use etc
sw.Close();
//create your cmd process to execute js file using wscript
Process process = new Process();
process.StartInfo.FileName = "wscript.exe";
process.StartInfo.WorkingDirectory = @"c:\";
process.StartInfo.Arguments = "SendShoreTelUsersHome.js";
process.Start();
//close everything we opened
myIE.ForceClose();
}
示例11: SDYD250
public static void SDYD250()
{
IE ie = new IE("about:blank");
ie.ShowWindow(NativeMethods.WindowShowStyle.Hide);
using(StreamWriter writer = new StreamWriter("data.txt")) {
writer.Write("Block:");
writer.Write(",");
writer.Write("Lot:");
writer.Write(",");
writer.Write("Prop Loc:");
writer.Write(",");
writer.Write("Land Desc:");
writer.Write(",");
writer.Write("Bldg Desc:");
writer.Write(",");
writer.Write("Taxes:");
writer.Write(",");
writer.Write("Sale Date:");
writer.Write(",");
writer.Write("Price:");
writer.Write(",");
writer.WriteLine("NU#:");
for(int blockNum = 1; blockNum <= 106; blockNum++) {
ie.GoTo("http://tax1.co.monmouth.nj.us/cgi-bin/prc6.cgi?&ms_user=glou&passwd=data&district=0912");
SelectList listSize = ie.SelectList(Find.By("name", "ms_ln"));
listSize.Select("1000");
TextField block = ie.TextField(Find.By("name", "block"));
block.TypeText(blockNum.ToString());
ie.Forms[0].Submit();
List<string> links = new List<string>();
Button submit = null;
bool goNextPage = false;
do {
foreach(Link l in ie.Links) {
links.Add(l.Url);
}
try {
submit = ie.Button(Find.By("value", "Next"));
if(submit != null && submit.Text.ToLower() == "next") {
ie.Forms[0].Submit();
goNextPage = true;
}
} catch(ElementNotFoundException e) {}
} while(goNextPage);
foreach(string url in links) {
ie.GoTo(url);
writer.Write(GetData("Block:", ie.Tables));
writer.Write(",");
writer.Write(GetData("Lot:", ie.Tables));
writer.Write(",");
writer.Write(GetData("Prop Loc:", ie.Tables));
writer.Write(",");
writer.Write(GetData("Land Desc:", ie.Tables));
writer.Write(",");
writer.Write(GetData("Bldg Desc:", ie.Tables));
writer.Write(",");
writer.Write(GetData("Taxes:", ie.Tables));
writer.Write(",");
writer.Write(GetData("Sale Date:", ie.Tables));
writer.Write(",");
string priceData = GetData("Price:", ie.Tables);
string[] split = priceData.Split(new string[] {"NU#:"}, StringSplitOptions.RemoveEmptyEntries);
writer.Write(split[0]);
if(split.Length > 1) {
writer.Write(",");
writer.WriteLine(split[1]);
}
writer.WriteLine("");
}
}
}
//ie.ShowWindow(NativeMethods.WindowShowStyle.Show);
//ie.CaptureWebPageToFile("searchresult.htm");
Console.WriteLine("Done!");
Console.Read();
}
示例12: 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;
}
}
示例13: 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;
}
}
示例14: WatinSelectList
public WatinSelectList(IE ie, PageDriver parent, string id)
: base(id, ie.SelectList(Find.ById(id)), parent)
{
}