1

I have a one liner Js for Selenium tests that checks if the page is done loading.

true  === ((typeof Ext.Ajax != 'undefined' && Ext.Ajax.isLoading()) || (jQuery != 'undefined' && jQuery.active) || document.readyState != 'complete')

All other Java/Selenium ways to check are NOT compatible with our setup line of IE FF and Chrome tests (crap IE). We spent like 3 months of trying, so Selenium checks are out of question. This check is ok most of the time, except when the Extjs variable is not set in that page then i get the dreaded Ext is not defined exception and selenium crashes. Is there an another way to check for a variable in one liner which can do nested checks i tried object checks like in

javascript test for existence of nested object key

But when i do

((Ext|| {}).Ajax

I still get the exception.

Sangoku
  • 1,588
  • 2
  • 21
  • 50

2 Answers2

1

As I have read the rest of the posts I have come across a solution:

(typeof Ext != 'undefined' ? Ext : {}) 
iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
Sangoku
  • 1,588
  • 2
  • 21
  • 50
1

This also should work:

(window.Ext || {}).Ajax
scebotari66
  • 3,395
  • 2
  • 27
  • 34