HasFocus() on Web Elements

Ranorex Studio, Spy, Recorder, and Driver.
Posts: 1
Joined: Wed Oct 03, 2012 11:16 am

HasFocus() on Web Elements

Post by DerBernie » Wed Oct 03, 2012 11:22 am


I'm trying to automate a web application (on Internet Explorer 9) with Ranorex 3.3

I need to validate if there is a blocking window preventing a click on a element on the website. For example, I want to click a button but there is a dialog open in the browser. The click is still performed (because the element exists) but doesn't do anything.

I tried to use "HasFocus" but that doesn't work (always returns false for any element BUT always returns true on the Body tag). Also calling Focus() on the element doesn't work.

Is there any possible to way to check if the window has currently the focus and there is no popup dialog blocking?

Thank you very much for your advices!

Best regards,

User avatar
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark

Re: HasFocus() on Web Elements

Post by artur_gadomski » Wed Oct 03, 2012 12:43 pm

Try Active on browser window.