In my Selenium tests, I have a single line of Js code that verifies if the page has finished loading.
true === ((typeof Ext.Ajax != 'undefined' && Ext.Ajax.isLoading()) || (jQuery != 'undefined' && jQuery.active) || document.readyState != 'complete')
All other Java/Selenium methods of checking are not suitable for our IE FF and Chrome test setup. We spent around 3 months attempting different approaches, so traditional Selenium checks are not an option. This method works well most of the time, except when the Extjs variable is missing on the page, leading to the Ext is not defined error and causing Selenium to crash. I am looking for an alternative way to check for a variable in one line of code that supports nested checks. I experimented with object checks like those discussed here, but even using ((Ext|| {}).Ajax) still triggers the exception.