本文整理汇总了C#中IWebDriver.IsAjaxPending方法的典型用法代码示例。如果您正苦于以下问题:C# IWebDriver.IsAjaxPending方法的具体用法?C# IWebDriver.IsAjaxPending怎么用?C# IWebDriver.IsAjaxPending使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWebDriver
的用法示例。
在下文中一共展示了IWebDriver.IsAjaxPending方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpecifyForBrowser
public override void SpecifyForBrowser(IWebDriver browser)
{
var waitHandle = beforeAll(() => new ManualResetEvent(false));
beforeEach(() => waitHandle.Reset());
var server = beforeAll(() => new NancyModuleRunner(c => c.Dependency(waitHandle).Module<SomeTestServer>()));
it("requires jQuery", delegate
{
browser.Navigate().GoToUrl(server.UrlFor("homepage.html"));
Assert.Throws<JQueryNotInstalledException>(delegate
{
browser.MonitorJQueryAjax();
});
Assert.Throws<JQueryNotInstalledException>(delegate
{
browser.IsAjaxPending();
});
});
describe("MonitorJQueryAjax", delegate
{
it("must be called before waiting on ajax", delegate
{
browser.Navigate().GoToUrl(server.UrlFor("pageWithJQuery.html"));
var exceptions = Assert.Throws<InvalidOperationException>(delegate
{
expect(() => !browser.IsAjaxPending());
});
expect(() => exceptions.Message.Contains("Must call MonitorJQueryAjax before waiting on ajax."));
});
it("installs some javascript code for monitoring", delegate
{
browser.Navigate().GoToUrl(server.UrlFor("pageWithJQuery.html"));
expect(() => !JQueryAjaxWaiter.WasMonitoringStarted(browser));
browser.MonitorJQueryAjax();
expect(() => JQueryAjaxWaiter.WasMonitoringStarted(browser));
});
it("doesnt reinstall that javascript code", delegate
{
browser.Navigate().GoToUrl(server.UrlFor("pageWithJQuery.html"));
browser.MonitorJQueryAjax();
var scriptExecutor = browser as IJavaScriptExecutor;
scriptExecutor.ExecuteScript("window.SizSelCsZzz_IsRequestPending.tracer = true;");
browser.MonitorJQueryAjax();
expect(() => (bool)scriptExecutor.ExecuteScript("return window.SizSelCsZzz_IsRequestPending.tracer;"));
});
});
describe("IsRequestPending indicates if an AJAX request is pending", delegate
{
it("returns false initially", delegate
{
browser.Navigate().GoToUrl(server.UrlFor("pageWithJQuery.html"));
browser.MonitorJQueryAjax();
expect(() => !browser.IsAjaxPending());
});
when("the browser starts a long-running ajax operation", delegate
{
arrange(delegate
{
browser.Navigate().GoToUrl(server.UrlFor("pageWithJQuery.html"));
browser.MonitorJQueryAjax();
var executor = browser as IJavaScriptExecutor;
executor.ExecuteScript("jQuery.ajax(" + Newtonsoft.Json.JsonConvert.SerializeObject(server.UrlFor("wait")) + ");");
});
ignoreIfInternetExplorer("not sure why this test isn't working on IE- may be a test only bug");
then("IsAjaxPending returns true", delegate
{
expect(() => browser.IsAjaxPending());
});
when("that longrunning call completes", delegate
{
beforeEach(() => waitHandle.Set());
then("IsAjaxPending returns false", delegate
{
expectEventually(() => !browser.IsAjaxPending());
//.........这里部分代码省略.........