本文整理汇总了C#中Browser.Eval方法的典型用法代码示例。如果您正苦于以下问题:C# Browser.Eval方法的具体用法?C# Browser.Eval怎么用?C# Browser.Eval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browser
的用法示例。
在下文中一共展示了Browser.Eval方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WaitForAsyncPostbackComplete
//http://www.codeproject.com/Articles/99838/WatinN-to-Automate-Browser-and-Test-Sophisticated
public static bool WaitForAsyncPostbackComplete(Browser browser, int timeout)
{
int timeWaitedInMilliseconds = 0;
var maxWaitTimeInMilliseconds = Settings.WaitForCompleteTimeOut * 1000;
var scriptToCheck =
"Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();";
while (bool.Parse(browser.Eval(scriptToCheck)) == true
&& timeWaitedInMilliseconds < maxWaitTimeInMilliseconds)
{
Thread.Sleep(Settings.SleepTime);
timeWaitedInMilliseconds += Settings.SleepTime;
}
return bool.Parse(browser.Eval(scriptToCheck));
}
示例2: PopulateTestPage
private string PopulateTestPage(ObituaryAdd oa, Browser browser)
{
var firstName = string.Format("DecFirst{0:MMddyyyy_hhmmss}", DateTime.Now);
var lastName = string.Format("DecLast{0:MMddyyyy_hhmmss}", DateTime.Now);
oa.txtDecFirstName = firstName;
oa.txtDecLastName = lastName;
oa.cmdDayDeath.Options[3].Select();
oa.cmdMonthDeath.Options[3].Select();
oa.drpMemorialDeathYear.Options[3].Select();
oa.txtContactFirstName = "ConFirst";
oa.txtContactLastName = "ConLast";
oa.txtContactPhone = "9205551212";
oa.txtObituary = "[center]Centered[/center]";
browser.Eval("window.eaaRichEdit.update()");
var previewDiv = (ElementContainer<Element>)browser.Element(Find.ById("main_0_eaamain_0_eaacontent_0_acmain_1_view_text"));
Assert.AreEqual(previewDiv.InnerHtml, "<center>Centered</center>");
return firstName;
}