How to detect whether a modal dialog is blocking mouseclicks

Ranorex Studio, Spy, Recorder, and Driver.
uhmdown
Posts: 54
Joined: Mon Apr 03, 2017 12:00 pm

How to detect whether a modal dialog is blocking mouseclicks

Post by uhmdown » Tue May 23, 2017 2:31 pm

Is there an elegant way to detect whether a button is unclickable because there is a modal popup present?
(modal = grabs focus and doesn't let go before it is closed again).
The button is visible and enabled, so the script thinks it can go ahead and click the button, when it in fact can not (due to the popup).

A PopupWatcher is trying to handle the popup, but an attempt to click the button is made too early, before the PopupWatcher closes the popup.

Of course, I could insert an excessively long delay to make sure the PopupWatcher always has time to finish, or I could have some loop that repeated tries to click the button until it succeeds, but I was hoping for something more elegant.

is there a smarter way to do this?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to detect whether a modal dialog is blocking mouseclicks

Post by odklizec » Tue May 23, 2017 3:11 pm

Hi,

The problem of popup watcher is that it runs in a second thread, which cannot pause/stop the main thread ;) This is why the test script continues without waiting for popupwatcher actions.

As for evaluating clickability of a button blocked by modal dialog, I think you can try evaluate "Enabled" attribute of given button? I would expect this attribute to be "false" if modal dialog is up? Eventually, you can add @enabled='True' attribute directly to the xpath of given button (in repository). Which means your script will click the button is enabled. Hope this helps?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration