Javascript - How to get your browser in focus -


i'm running script on retail site when browser in focus, passes every time. when browser not in focus, fails every time.

my waituntil(waits.elementdisplayed(.... doesn't work when not in focus.

any ideas ?

thanks

you can detect if browser out of focus following javascript function

function onblur() {     document.body.classname = 'blurred'; }; function onfocus(){     document.body.classname = 'focused'; };  if (/*@cc_on!@*/false) { // check internet explorer     document.onfocusin = onfocus;     document.onfocusout = onblur; } else {     window.onfocus = onfocus;     window.onblur = onblur; } 

reference

however, i'm not sure if getfocus if out of focus. hope helps.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -