You can call this method before you want to check a field (or during loading method – i am using onLoad ). Call this method with driver as first parameter and AJAX request call as String. It will set scripting timeout at first and execute JS asynchronous script.
You can use it by calling this static method like this:
As driver you have to use actual WebDriver (for example: WebDriver driver = new FirefoxDriver(); – this will return you actual driver – Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation) and as Ajax_method you pass the name of Ajax calling. You can open page and via Developer tools of web browser find a name of call in Resources. This will help you only if you know on which Ajax call you are waiting.
I hope that this will help you and save your time.