Page 1 of 1
Test is getting stuck when modal dialog appears after Press
Posted: Mon May 29, 2017 10:11 am
by i.vasilyev
Hello.
Env:
Ranorex 7.0(VS+ref to ranorex libs)
Win 10
AUT: Desktop app
Problem:
I faced with following problem. Test is getting stuck(nothing happens) when modal dialog appears after Button.Press() And continues to work fine when modal dialog closed manually(tested while debugging). Can somebody explain why?
Code:
Code: Select all
Host.Local.FindSingle<Button>(locator, FindElementTimeOut).Press();
Re: Test is getting stuck when modal dialog appears after Press
Posted: Mon May 29, 2017 11:52 am
by odklizec
Hi,
Have you tried Shift+Pause shortcut (during problematic action)? Maybe The FindSingle just searches it too long? Shift+Pause skip delays and timeouts during playback. So if there is a problem with xpath behind the element, you should quickly find the source of problem.
Re: Test is getting stuck when modal dialog appears after Press
Posted: Mon May 29, 2017 12:36 pm
by asdf
Hi,
I think that the Press()-method is very similar to the web-based PerformClick()-method. If you open a FileDialog with PerformClick(), the method waits until the dialog is closed, since the PerformClick()-method waits for an event to finish.
I would suggest performing a simple Click-action on the element in question.
I hope that helps.
Kind regards,
asdf
Re: Test is getting stuck when modal dialog appears after Press
Posted: Mon May 29, 2017 1:36 pm
by odklizec
Agree with asdf! I completely forgot about this
If there is an on-click even attached to that button, it may not be performed by
Press method. Use
Click instead, which generates proper "mouse click" events.
Re: Test is getting stuck when modal dialog appears after Press
Posted: Tue May 30, 2017 12:04 pm
by i.vasilyev
Ok, got it. Can somebody explain the profit of this behavior?
Re: Test is getting stuck when modal dialog appears after Press
Posted: Tue May 30, 2017 2:20 pm
by Vaughan.Douglas
i.vasilyev wrote:Ok, got it. Can somebody explain the profit of this behavior?
I was not aware that PerformClick() waits for the event to finish, but that creates all sorts of intriguing possibilities like handing off the handling of the FileDialog to a popup watcher. Why you'd want to do this from a practical standpoint eludes me at the moment, but off the top of my head I think it might be a way to encapsulate the file dialog objects/methods specific to each browser.
I'd be interested in what others find useful about this behavior.
Re: Test is getting stuck when modal dialog appears after Press
Posted: Thu Jun 01, 2017 1:59 pm
by asdf
Hi all,
When using the
performClick()-method, the method in the application itself will get triggered. Therefore, it doesn't simulate a real user as good as the click() method provided by Ranorex.
I definitely recommend using the "normal" click method, unless it is not necessary to use PerformClick().
Hope this helps.
Re: Test is getting stuck when modal dialog appears after Press
Posted: Thu Jun 01, 2017 4:39 pm
by Vaughan.Douglas
This is the case for most of the invokes. My particular pet peeve is these squirrely select boxes. I can't do a clink or perform click because the screen bounces around. I have to invoke the set selected method on the target option. The giant flaw in this is that it disconnects the actual user "click" on the UI with the invocation of the click event. This means that if there is some sort of problem where the user could NOT click on the object, the set select would miss it.