While testing a page with Selenium WebDriver, I encountered an issue related to the Sencha JavaScript library being used on the underlying page. The problem arises when I input a value into a field and an AJAX call is made to validate that field. If the value is invalid, the field gets highlighted in red, but if it's valid, nothing changes on the page.
The challenge I'm facing is that my script attempts to navigate away from the page before the validation call completes. Although one solution could be to add an explicit wait time, that is not always the most effective approach.
Currently, for my Java driver, I have set these options (timeout is 120):
int timeout = 120;
driver.manage().timeouts().implicitlyWait(timeout, TimeUnit.SECONDS);
driver.manage().timeouts().setScriptTimeout(timeout, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(timeout, TimeUnit.SECONDS);
I am aware that I can wait for jQuery AJAX calls using the following method:
JavascriptExecutor executer = (JavascriptExecutor) driver;
Boolean jqueryDone = (Boolean) executer.executeScript("return jQuery.active == 0");
and then encapsulate this within a Wait condition. However, I am curious if there is a similar check that can be made specifically for Sencha/ExtJS?