Test is getting stuck when modal dialog appears after Press

Class library usage, coding and language questions.
i.vasilyev
Posts: 30
Joined: Fri Sep 09, 2016 10:14 am

Test is getting stuck when modal dialog appears after Press

Post by i.vasilyev » Mon May 29, 2017 10:11 am

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();

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

Re: Test is getting stuck when modal dialog appears after Press

Post by odklizec » Mon May 29, 2017 11:52 am

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.
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

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Test is getting stuck when modal dialog appears after Press

Post by asdf » Mon May 29, 2017 12:36 pm

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

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

Re: Test is getting stuck when modal dialog appears after Press

Post by odklizec » Mon May 29, 2017 1:36 pm

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.
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

i.vasilyev
Posts: 30
Joined: Fri Sep 09, 2016 10:14 am

Re: Test is getting stuck when modal dialog appears after Press

Post by i.vasilyev » Tue May 30, 2017 12:04 pm

Ok, got it. Can somebody explain the profit of this behavior?

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Test is getting stuck when modal dialog appears after Press

Post by Vaughan.Douglas » Tue May 30, 2017 2:20 pm

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.
Doug Vaughan

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Test is getting stuck when modal dialog appears after Press

Post by asdf » Thu Jun 01, 2017 1:59 pm

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.

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Test is getting stuck when modal dialog appears after Press

Post by Vaughan.Douglas » Thu Jun 01, 2017 4:39 pm

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.
Doug Vaughan