Skip to content

Instantly share code, notes, and snippets.

@huguogang
Last active December 24, 2015 08:59
Show Gist options
  • Save huguogang/6774584 to your computer and use it in GitHub Desktop.
Save huguogang/6774584 to your computer and use it in GitHub Desktop.
Java code to inject javascript and check for ExtJS Ajax error
//make sure it's run after every page load
public static void injectSJTXE(WebDriver driver) throws IOException {
URL url;
String js;
url = Resources.getResource(ExtJSUtil.class, "SJTXE.js");
js = Resources.toString(url, Charsets.UTF_8);
((JavascriptExecutor) driver).executeScript(js);
}
//code to check if there are ExtJS Ajax error
Boolean hasAjaxFailure = (Boolean) ((JavascriptExecutor) driver).executeScript("return SJTXE.hasAjaxFailure();");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment