Skip to content

Commit

Permalink
Wait for ajax function added
Browse files Browse the repository at this point in the history
  • Loading branch information
marco.ippel committed Jul 10, 2015
1 parent e1b2d52 commit ee51aa7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SeleniumTestTemplate/Business/SeleniumBase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Configuration;
using System.Threading;
using OpenQA.Selenium;
using SeleniumTestTemplate.Enums;
using SeleniumTestTemplate.Extensions;
Expand Down Expand Up @@ -89,5 +90,16 @@ protected void SubmitData()
{
Driver.GetElementByAttribute(ElementType.Button, AttributeType.Type, "submit").Click();
}

protected void WaitForAjax()
{
while (true) // Handle timeout somewhere
{
var ajaxIsComplete = (bool)(Driver as IJavaScriptExecutor).ExecuteScript("return jQuery.active == 0");
if (ajaxIsComplete)
break;
Thread.Sleep(100);
}
}
}
}

0 comments on commit ee51aa7

Please sign in to comment.