本文整理汇总了C#中Browser.WaitForComplete方法的典型用法代码示例。如果您正苦于以下问题:C# Browser.WaitForComplete方法的具体用法?C# Browser.WaitForComplete怎么用?C# Browser.WaitForComplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browser
的用法示例。
在下文中一共展示了Browser.WaitForComplete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeletePost
private static void DeletePost(Element post, Browser browser)
{
var postId = post.Id.Replace("post-", string.Empty);
var deletLink = browser.Links.SingleOrDefault(_ =>
{
var href = _.GetAttributeValue("href");
return !string.IsNullOrEmpty(href) && Regex.IsMatch(_.GetAttributeValue("href"),
"delete.*" + postId);
});
if (deletLink != null)
{
var confirmDialogHandler = new ConfirmDialogHandler();
using (new UseDialogOnce(browser.DialogWatcher, confirmDialogHandler))
{
deletLink.ClickNoWait();
confirmDialogHandler.WaitUntilExists();
confirmDialogHandler.OKButton.Click();
browser.WaitForComplete();
}
}
else
{
AddToErrorLog(customeMessage: "Номогу найти кнопку удалить у сообщения");
}
}
示例2: EditMatch
/// <summary>
/// Method Edits a Match (Base or Associated) on the Edits -> Add Vertical Edit page
/// </summary>
/// <param name="browser">WatiN Browser Object</param>
/// <param name="name"></param>
/// <param name="fieldtype"></param>
/// <param name="field"></param>
/// <param name="oper"></param>
/// <param name="value"></param>
/// <param name="save">Save Value true will save false will cancel</param>
public void EditMatch(Browser browser, string name, string fieldtype, string field, string oper, string value, string save)
{
browser.TextField(Find.ById(new Regex("ctl00_MainContent_rpMatchDetails_ASPxRoundPanel1_tBoxMatchName"))).SetAttributeValue("value", name);
browser.Button(Find.ById(new Regex("ctl00_MainContent_rpMatchDetails_ASPxRoundPanel1_cmdAddEditCondition"))).Click();
browser.WaitForComplete();
browser.TextField(Find.ById(new Regex("ctl00_MainContent_EditConditionControl_rpEditCondition_tBoxECType"))).Focus();
if (!fieldtype.Equals(""))
{
SelectFieldType(browser, fieldtype);
}
browser.TextField(Find.ById(new Regex("ctl00_MainContent_EditConditionControl_rpEditCondition_tBoxECField"))).Focus();
if (!field.Equals(""))
{
SelectField(browser, field);
}
browser.TextField(Find.ById(new Regex("ctl00_MainContent_EditConditionControl_rpEditCondition_tBoxECOperator"))).Focus();
if (!oper.Equals(""))
{
SelectListItem(browser, oper);
}
browser.TextField(Find.ById(new Regex("ctl00_MainContent_EditConditionControl_rpEditCondition_tBoxECValue"))).SetAttributeValue("value", value);
if (save.Equals("Y"))
{
browser.Button(Find.ById(new Regex("ctl00_MainContent_EditConditionControl_rpEditCondition_cmdUpdate"))).Click();
}
else
{
browser.Button(Find.ById(new Regex("ctl00_MainContent_EditConditionControl_rpEditCondition_cmdCancel"))).Click();
}
}
示例3: NewUserSave
/// <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="firstname">First Name Value</param>
/// <param name="mi">Middle Initial Value</param>
/// <param name="lastname">Last Name Value</param>
/// <param name="username">User Name Value</param>
/// <param name="language">Language Value</param>
/// <param name="approvallimit">Approval Limit Value</param>
/// <param name="efrom">Effective From Value</param>
/// <param name="eto">Effective To Value</param>
/// <param name="isinternal">Sets Is Internal Checkbox to value</param>
/// <param name="role">Role Value</param>
/// <param name="password">Password Value</param>
/// <param name="save">Save flag true will save false will flash</param>
public void NewUserSave(Browser browser, string firstname, string mi, string lastname,
string username, string language, string approvallimit,
string efrom, string eto, bool isinternal, string role, string password, bool save)
{
// TODO: Make these separate methods.
browser.Button(Find.ById(new Regex("ctl00_MainContent_NewUserButton"))).Click();
browser.WaitUntilContainsText("Add New User");
// Enter Names
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_FirstNameTextBox_I"))).SetAttributeValue("value", firstname);
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_MiddleInitialTextBox_I"))).SetAttributeValue("value", mi);
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_LastNameTextBox_I"))).SetAttributeValue("value", lastname);
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_UserCodeTextBox_I"))).SetAttributeValue("value", username);
if (!language.Equals(""))
{
SelectLanguage(browser, language);
}
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_ApprovalLimitTextBox_I"))).SetAttributeValue("value", approvallimit);
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_EffectiveFromDateEdit_I"))).FireEventNoWait("onkeydown");
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_EffectiveFromDateEdit_I"))).TypeText(efrom);
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_EffectiveFromDateEdit_I"))).FireEventNoWait("onkeydown");
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_EffectiveThruDateEdit_I"))).TypeText(eto);
browser.CheckBox(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_InternalCheckBox_I"))).Checked = isinternal;
browser.WaitForComplete();
if (isinternal == false)
{
browser.TextField(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_ASPxRoundPanel1_UserPasswordTextBox_I"))).SetAttributeValue("value", password);
}
browser.CheckBox(Find.ByLabelText(role)).Checked = true;
// TODO Add Save Button
if (save == true)
{
browser.Button(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_SaveButton"))).Click();
}
else
{
browser.Button(Find.ById(new Regex("ctl00_MainContent_ASPxRoundPanel2_SaveButton"))).Flash();
}
}
示例4: TestUseradddiscount
public void TestUseradddiscount(Browser browser,string date)
{
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_btnNew")).Click();
//日期
browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtStartDate")).TypeText(date);
browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtEndDate")).TypeText(date);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnPricelistDetail")).Click();
/*
//选供应商
browser.Image(Find.ByTitle("供应商查询")).ClickNoWait();
Browser DW=IE.AttachToIE(Find.ByUrl("http://192.168.0.21/Trade/Price/OrgDetail.aspx?index=ctl00_ContentPlaceHolder1_gvDetail_ctl02_"));
DW.TextField("txtDWMC").TypeText("自动供应商");
DW.Button("btnSearch").Click();
//DW.Button(Find.ByName("1001")).Click();
DW.Button(Find.ByValue("选择")).Click();
/*
//选小品种
browser.Image(Find.ByTitle("品种查询")).ClickNoWait();
Browser DW1=IE.AttachToIE(Find.ByUrl("http://192.168.0.21/Trade/Price/Product.aspx?orgid=0&index=ctl00_ContentPlaceHolder1_gvDetail_ctl02_"));
browser.WaitUntilContainsText("小品种代码");
DW1.TextField(Find.ById("txtProductName")).TypeText("焊接用钢盘条");
DW1.Button(Find.ById("btnSearch")).Click();
DW1.Button(Find.ByValue("选择")).Click();*/
//选资源
browser.Image(Find.ByTitle("资源查询")).ClickNoWait();
Browser DW2=IE.AttachToIE(Find.ByUrl("http://192.168.0.21/Trade/Price/ProductDetail.aspx?orgid=0&productid=0&index=ctl00_ContentPlaceHolder1_gvDetail_ctl02_"));
browser.WaitForComplete(120);
DW2.TextField(Find.ById("txtcz")).TypeText("脚本");
DW2.Button(Find.ById("Button1")).Click();
DW2.Button(Find.ByValue("选择")).Click();
browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_gvDetail_ctl02_txtQty")).TypeText("1");
browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_gvDetail_ctl02_txtAmount")).TypeText("100");
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnSave")).ClickNoWait();
browser.WaitUntilContainsText("折扣设置");
Assert.IsTrue(browser.ContainsText("折扣设置"));
//状态生效
raid=browser.RadioButton(Find.ByName("radionSelect")).Id;
browser.RadioButton(Find.ByName("radionSelect")).Checked = true;
WatiN.Core.DialogHandlers.ConfirmDialogHandler dh4 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();
browser.AddDialogHandler(dh4);
browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnEffect")).ClickNoWait();
dh4.WaitUntilExists(15);//
dh4.OKButton.Click();//
dh4.WaitUntilExists(15);
dh4.OKButton.Click();
browser.RemoveDialogHandler(dh4);
Thread.Sleep(1000);
}
示例5: SelectOrderItems
internal static void SelectOrderItems(Browser browser, ConferenceInfo conferenceInfo, Table table, bool navigateToRegPage = true)
{
if (navigateToRegPage)
{
browser.GoTo(Constants.RegistrationPage(conferenceInfo.Slug));
browser.WaitForComplete((int)Constants.UI.WaitTimeout.TotalSeconds);
}
foreach (var row in table.Rows)
{
browser.SelectListInTableRow(row["seat type"], row["quantity"]);
}
}
示例6: NavToGBHome
/// <summary>
/// Method to Navigate to the Greenbrier Home Page
/// </summary>
/// <param name="browser"></param>
public void NavToGBHome(Browser browser)
{
browser.Link(Find.ByText(new Regex("The Greenbrier Companies"))).Click();
browser.WaitForComplete();
}
示例7: Login
/// <summary>
/// Method to Login to the Entrust Application
/// </summary>
/// <param name="browser">WatiN Browser Object</param>
/// <param name="username"></param>
/// <param name="password"></param>
public void Login(Browser browser, string username, string password)
{
Element usernamefield = browser.Element(Find.ById(new Regex("username")));
System.Drawing.Point clickPoint = GetScreenPoint((IEElement)usernamefield.NativeElement);
Move(clickPoint);
browser.TextField(Find.ById(new Regex("username"))).SetAttributeValue("value", username);
browser.TextField(Find.ById(new Regex("password"))).SetAttributeValue("value", password);
browser.Button(Find.ByValue(new Regex("Log In"))).ClickNoWait();
browser.WaitForComplete();
}
示例8: Do
private static void Do(Action<Browser> action, Browser browser)
{
action(browser);
browser.WaitForComplete();
}