本文整理匯總了C#中Browser.Button方法的典型用法代碼示例。如果您正苦於以下問題:C# Browser.Button方法的具體用法?C# Browser.Button怎麽用?C# Browser.Button使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Browser
的用法示例。
在下文中一共展示了Browser.Button方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestUserladbilldeliversearch
//public static string ladorderid;
public void TestUserladbilldeliversearch(Browser browser, string url, string orderid)
{
browser.Link(Find.ByText("我要銷售")).Click();
browser.WaitUntilContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南");
Assert.IsTrue(browser.ContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南"));
browser.Link(Find.ByText("可發資源查詢")).Click();
browser.WaitUntilContainsText("可提資源查詢");
Assert.IsTrue(browser.ContainsText("可提資源查詢"));
//先清空
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnCleanDelivery")).ClickNoWait();
/*
//測試用
string ss = "0904000070";
int s1 = int.Parse(ss);
int s2 = s1 + 1;
string ss1 = s2.ToString();
*/
//
Thread.Sleep(1500);
browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtOrderCode")).TypeText(orderid);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_Button1")).Click();
//截取ID
string l1 = browser.Span(Find.ByText("焊接用鋼盤條")).Id;
string l3 = l1.Trim().Substring(13, 4);
browser.Link(Find.ById("a_order_" + l3)).Click();
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_NextStepBtn")).Click();
browser.WaitUntilContainsText("在此頁麵中您可選擇對此提單的處理方式,如無疑義,可點擊創建提單完成");
Assert.IsTrue(browser.ContainsText("在此頁麵中您可選擇對此提單的處理方式,如無疑義,可點擊創建提單完成"));
browser.Table(Find.ById("ctl00_ContentPlaceHolder1_GridView1")).TableRow(Find.ByClass("RowBg")).WaitUntilExists(10);
//Assert.AreEqual("xx",browser.Table(Find.ById("ctl00_ContentPlaceHolder1_GridView1")).TableRow(Find.ByClass("RowBg")).TableCells[1].Text);
string ladorderid = browser.Table(Find.ById("ctl00_ContentPlaceHolder1_GridView1")).TableRow(Find.ByClass("RowBg")).TableCells[1].Text;
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_Button3")).Click();
//發貨單確認
browser.Link(Find.ByText("發貨單確認")).Click();
browser.WaitUntilContainsText("提單管理");
Assert.IsTrue(browser.ContainsText("提單管理"));
WatiN.Core.DialogHandlers.ConfirmDialogHandler dh2 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();
browser.AddDialogHandler(dh2);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_GridView1_ctl02_ConfirmBtn")).ClickNoWait();
dh2.WaitUntilExists(15);//
dh2.OKButton.Click();//
browser.RemoveDialogHandler(dh2);
}
示例2: FindButton
private static Element FindButton(Browser browser, string value)
{
Element element = browser.Button(Find.ById(value));
if (!element.Exists)
{
return browser.Button(b =>
(b.OuterText != null && b.OuterText.Contains(value)) ||
(b.Value != null && b.Value.Contains(value)));
}
return element;
}
示例3: TestUsercanceldiscont
public void TestUsercanceldiscont(Browser browser,string raid,string raname)
{
browser.Link(Find.ByText("平台管理")).Click();
browser.WaitUntilContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南");
Assert.IsTrue(browser.ContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南"));
browser.Link(Find.ByText("銷售折扣管理")).Click();
browser.WaitUntilContainsText("折扣設置");
Assert.IsTrue(browser.ContainsText("折扣設置"));
//狀態生效
browser.RadioButton(Find.ById(raid)).Checked = true;
WatiN.Core.DialogHandlers.ConfirmDialogHandler dh4 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();
browser.AddDialogHandler(dh4);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnDelete")).ClickNoWait();
dh4.WaitUntilExists(15);//
dh4.OKButton.Click();//
browser.RemoveDialogHandler(dh4);
Thread.Sleep(1000);
Assert.IsFalse(browser.ContainsText(raname));
}
示例4: TestUserverifylad
public void TestUserverifylad(Browser browser)
{
browser.Link(Find.ById("ctl00_linkTrade")).Click();
browser.WaitUntilContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南");
Assert.IsTrue(browser.ContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南"));
browser.Link(Find.ByText("我要銷售")).Click();
browser.WaitUntilContainsText("請在左邊的菜單選擇您要進行的操作");
Assert.IsTrue(browser.ContainsText("請在左邊的菜單選擇您要進行的操作"));
browser.Link(Find.ByText("我的議價信息")).Click();
browser.WaitUntilContainsText("合同號");
Assert.IsTrue(browser.ContainsText("合同號"));
browser.Link(Find.ByText("議價")).Click();
//WatiN.Core.DialogHandlers.ConfirmDialogHandler dh3 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();
//browser.AddDialogHandler(dh3);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnAccept")).ClickNoWait();
//dh3.WaitUntilExists(15);//
//dh3.OKButton.Click();//
//browser.RemoveDialogHandler(dh3);
//Thread.Sleep(2000);
}
示例5: AddBadActor
/// <summary>
/// Method to Add a Bad Actor
/// See AddVerticalEdit for param description
/// </summary>
/// <param name="browser">WatiN Browser Object</param>
/// <param name="name"></param>
/// <param name="level"></param>
/// <param name="efrom"></param>
/// <param name="eto"></param>
/// <param name="exception"></param>
/// <param name="errortype"></param>
/// <param name="days"></param>
/// <param name="errcount"></param>
/// <param name="countat"></param>
/// <param name="recprob"></param>
/// <param name="source"></param>
/// <param name="errorlevel"></param>
/// <param name="reqcon"></param>
/// <param name="configpath"></param>
/// <param name="basematches"></param>
/// <param name="associatedmatches"></param>
/// <param name="commit"></param>
/// <param name="save"></param>
///
public void AddBadActor(Browser browser, string name, string level, string efrom, string eto, string exception, string errortype, string days, string errcount,
string countat, string recprob, string source, string errorlevel, string reqcon, string configpath, bool basematches, bool associatedmatches, bool commit, bool save)
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(configpath);
XmlNode xn = xmldoc.SelectSingleNode("//config/admin/matchpath");
string basepath = xn.InnerText;
browser.Button(Find.ById(new Regex("ctl00_MainContent_rpEdits_cmdNewBA"))).Click();
browser.WaitUntilContainsText("Effective From");
EditDetails(browser, name, level, efrom, eto, exception, errortype, recprob, source, errorlevel);
browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpEditDetails_tBoxTSID"))).SetAttributeValue("value", days);
browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpEditDetails_tBoxNoOfTimes"))).SetAttributeValue("value", errcount);
browser.RadioButton(Find.ByLabelText(countat)).Checked = true;
if (basematches == true)
{
EditBaseMatches(browser, basepath, commit);
}
SaveDetails(browser, save);
}
示例6: Should_Click_Search_On_Google_And_Return_Results_For_AspNet
public void Should_Click_Search_On_Google_And_Return_Results_For_AspNet(Browser browser)
{
browser.GoTo("http://www.google.co.uk");
browser.TextField(Find.ByName("q")).Value = "asp.net";
browser.Button(Find.ByName("btnG")).Click();
string testString = "The Official Microsoft ASP.NET Site";
browser.WaitUntilContainsText(testString);
Assert.True(browser.ContainsText(testString));
browser.Dispose();
}
示例7: Should_navigate_to_google_2
public void Should_navigate_to_google_2()
{
Settings.WaitForCompleteTimeOut = 5;
Settings.WaitUntilExistsTimeOut = 5;
_browser = new Watin.BrowserDrivers.WebDriver.WebDriver(new ChromeDriver(), new Uri("http://www.google.com"));
_browser.TextField(Find.ByName("q")).TypeText("WatiN meets WebDriver");
_browser.Button(Find.ByName("btnG")).Click();
Assert.That(_browser.Url, Is.StringContaining("q=WatiN+meets+WebDriver"));
}
示例8: TestUserfullpay
public void TestUserfullpay(Browser browser,string pay)
{
browser.Link(Find.ByText("合同生效配款")).Click();
browser.WaitUntilContainsText("合同生效配款");
Assert.IsTrue(browser.ContainsText("合同生效配款"));
//截取訂單號碼
Thread.Sleep(1500);
string l1 = browser.Button(Find.ByClass("btnStyle")).GetAttributeValue("onclick");
string l3 = l1.Trim().Substring(19, 10);
orderid = l3;
browser.Button(Find.ByClass("btnStyle")).Click();
browser.WaitUntilContainsText("雙擊配款行即可完成或取消配款金額選擇");
Assert.IsTrue(browser.ContainsText("雙擊配款行即可完成或取消配款金額選擇"));
browser.TextField(Find.ById("txtPay_"+pay)).DoubleClick();
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnallocation")).Click();
browser.WaitUntilContainsText("按鈕完成本次配款,或點擊");
Assert.IsTrue(browser.ContainsText("按鈕完成本次配款,或點擊"));
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btncomplete")).Click();
}
示例9: TestUserladingbillsearch
//public static string ladorderid;
public void TestUserladingbillsearch(Browser browser, string url, string orderid)
{
browser.Link(Find.ByText("可提資源查詢")).Click();
browser.WaitUntilContainsText("可提資源查詢");
Assert.IsTrue(browser.ContainsText("可提資源查詢"));
//先清空
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnCleanDelivery")).ClickNoWait();
/*
//測試用
string ss = "0904000070";
int s1 = int.Parse(ss);
int s2 = s1 + 1;
string ss1 = s2.ToString();
*/
//
Thread.Sleep(1500);
browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtOrderCode")).TypeText(orderid);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_Button1")).Click();
//截取ID
string l1 = browser.Span(Find.ByText("焊接用鋼盤條")).Id;
string l3 = l1.Trim().Substring(13, 4);
browser.Link(Find.ById("a_order_"+l3)).Click();
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_NextStepBtn")).Click();
browser.WaitUntilContainsText("在此頁麵中您可選擇對此提單的處理方式,如無疑義,可點擊創建提單完成");
Assert.IsTrue(browser.ContainsText("在此頁麵中您可選擇對此提單的處理方式,如無疑義,可點擊創建提單完成"));
browser.Table(Find.ById("ctl00_ContentPlaceHolder1_GridView1")).TableRow(Find.ByClass("RowBg")).WaitUntilExists(10);
//Assert.AreEqual("xx",browser.Table(Find.ById("ctl00_ContentPlaceHolder1_GridView1")).TableRow(Find.ByClass("RowBg")).TableCells[1].Text);
string ladorderid = browser.Table(Find.ById("ctl00_ContentPlaceHolder1_GridView1")).TableRow(Find.ByClass("RowBg")).TableCells[1].Text;
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_Button3")).Click();
}
示例10: TestUsercheckdiscount
public void TestUsercheckdiscount(Browser browser, string url, string material, string date1, string number)
{
browser.Link(Find.ById("ctl00_linkTrade")).Click();
browser.WaitUntilContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南");
Assert.IsTrue(browser.ContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南"));
browser.Link(Find.ByText("我要采購")).Click();
browser.WaitUntilContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南");
Assert.IsTrue(browser.ContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南"));
//采購
browser.Link(Find.ByUrl(url + "SearchProduct.aspx")).Click();
browser.WaitUntilContainsText("清空購物車");
Assert.IsTrue(browser.ContainsText("清空購物車"));
//查詢資源
browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtSteel_Num")).TypeText(material + date1);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnSearch1")).Click();
//清空購物車
WatiN.Core.DialogHandlers.ConfirmDialogHandler dh2 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();
browser.AddDialogHandler(dh2);
browser.Link(Find.ById("ctl00_ContentPlaceHolder1_linkClearCart")).ClickNoWait();
dh2.WaitUntilExists(15);//
dh2.OKButton.Click();//
browser.RemoveDialogHandler(dh2);
Thread.Sleep(1500);
//點擊該資源並購買
browser.Image(Find.ByAlt("buy product")).Click();
browser.TextField(Find.ByClass("cinput")).TypeText(number);
browser.WaitUntilContainsText(number);
Assert.IsTrue(browser.ContainsText(number));
browser.Button(Find.ByClass("addBuyCartBtn")).Click();
Thread.Sleep(1500);
browser.WaitUntilContainsText("優惠後總額 900.00元");
Assert.IsTrue(browser.ContainsText("優惠後總額 900.00元"));
}
示例11: TestUserladingbillmanageadmin
public void TestUserladingbillmanageadmin(Browser browser, string url)
{
browser.Link(Find.ByText("提單管理")).Click();
browser.WaitUntilContainsText("提單管理");
Assert.IsTrue(browser.ContainsText("提單管理"));
WatiN.Core.DialogHandlers.ConfirmDialogHandler dh2 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();
browser.AddDialogHandler(dh2);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_GridView1_ctl02_ConfirmBtn")).ClickNoWait();
dh2.WaitUntilExists(15);//
dh2.OKButton.Click();//
browser.RemoveDialogHandler(dh2);
}
示例12: TestUserOrderSelectZipRadius
public void TestUserOrderSelectZipRadius(Browser browser)
{
browser.WaitUntilContainsText("Step 1: Select Target Area(s) - Radius around Zip");
Assert.IsTrue(browser.ContainsText("Step 1: Select Target Area(s) - Radius around Zip"));
browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_uxZip")).TypeText("10017");
browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_tbRadius")).TypeText("0");
browser.TextField(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_tbRadius")).TypeText("5");
Thread.Sleep(1000);
browser.WaitUntilContainsText("5");
Thread.Sleep(1000);
browser.Button(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_btSearch")).Click();
Thread.Sleep(1000);
browser.Link(Find.ById("ctl00_ctl00_uxContent_ContentPlaceHolder1_lbtNext")).Click();
}
示例13: TestUserchangesourcetype
public void TestUserchangesourcetype(Browser browser, string pricetype)
{
browser.Link(Find.ByText("資源數據維護")).Click();
browser.WaitUntilContainsText("本頁可進行已掛資源價格修改");
Assert.IsTrue(browser.ContainsText("本頁可進行已掛資源價格修改"));
browser.CheckBox(Find.ByName("ckbLotMaster")).Checked = true;
//browser.SelectList(Find.ById("ctl00_ContentPlaceHolder1_gvLotMaster_ctl02_ddlPricetype")).Option(Find.ByText(pricetype)).Select();
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnEditType")).Click();
browser.Frame(Find.ById("wheatmsg_ifrm")).SelectList(Find.ById("ddlPriceType")).Option(Find.ByValue(pricetype)).Select();
browser.Frame(Find.ById("wheatmsg_ifrm")).Button(Find.ById("btnYes")).Click();
/*WatiN.Core.DialogHandlers.ConfirmDialogHandler dh = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();
browser.AddDialogHandler(dh);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnEditType")).ClickNoWait();
dh.WaitUntilExists(15);//
dh.OKButton.Click();//
browser.RemoveDialogHandler(dh);*/
}
示例14: TestUsercancelsource
public void TestUsercancelsource(Browser browser)
{
browser.Link(Find.ById("ctl00_linkTrade")).Click();
browser.WaitUntilContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南");
Assert.IsTrue(browser.ContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南"));
browser.Link(Find.ByText("我要銷售")).Click();
browser.WaitUntilContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南");
Assert.IsTrue(browser.ContainsText("請在左邊的菜單選擇您要進行的操作。 如有疑問,請點擊下麵相關鏈接查看操作流程圖或查看交易指南"));
browser.Link(Find.ByText("資源撤牌管理")).Click();
browser.WaitUntilContainsText("本頁可選擇需要撤牌的資源,進行撤牌");
Assert.IsTrue(browser.ContainsText("本頁可選擇需要撤牌的資源,進行撤牌"));
WatiN.Core.DialogHandlers.ConfirmDialogHandler dh2 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();
browser.AddDialogHandler(dh2);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnTakeDownAll")).ClickNoWait();
dh2.WaitUntilExists(15);//
dh2.OKButton.Click();//
browser.RemoveDialogHandler(dh2);
}
示例15: NewExceptionReason
/// <summary>
/// Method Creates a New User on the Admin -> New User page.
/// Will Save if save == true else will flash the Save button.
/// </summary>
/// <param name="browser">WatiN Browser Object</param>
/// <param name="code">Code Value</param>
/// <param name="category">Category Value</param>
/// <param name="description">Description Value</param>
/// <param name="probability">Probability Value</param>
/// <param name="source">Source Value</param>
/// <param name="type">Type Value</param>
/// <param name="efrom">Effective From Value</param>
/// <param name="eto">Effective To Value</param>
/// <param name="save">Save Value</param>
public void NewExceptionReason(Browser browser, string code, string category, string description, string probability, string source, string type, string efrom, string eto, bool save)
{
browser.Button(Find.ById(new Regex("ctl00_MainContent_NewButton"))).Click();
browser.WaitUntilContainsText("Effective From");
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ResultsRoundPanel_ExceptionReasonsGridView_DXEditor1_I"))).SetAttributeValue("value", code);
if (!category.Equals(""))
{
SelectERCategory(browser, category);
}
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ResultsRoundPanel_ExceptionReasonsGridView_DXEditor3_I"))).SetAttributeValue("value", description);
if (!probability.Equals(""))
{
SelectERProbability(browser, probability);
}
if (!source.Equals(""))
{
SelectERSource(browser, source);
}
if (!type.Equals(""))
{
SelectERType(browser, type);
}
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ResultsRoundPanel_ExceptionReasonsGridView_DXEditor7_I"))).TypeText(efrom);
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ResultsRoundPanel_ExceptionReasonsGridView_DXEditor8_I"))).TypeText(eto);
if (save == true)
{
browser.Image(Find.ByTitle("Update")).Click();
}
else
{
browser.Image(Find.ByTitle("Cancel")).Click();
}
}