Bug: PerformClick waits indefinitely if no response...

Bug reports.
carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Bug: PerformClick waits indefinitely if no response...

Post by carsonw » Thu Jul 24, 2014 9:21 pm

This was tricky to figure out and one of our team members came up with a theory that our tests seem to support.

If we do a PerformClick on an object on the page, which then results in that page immediately becoming unavailable, PerformClick successfully clicks but will wait forever for a response essentially "hanging" your test.

I am able to reproduce this consistently.

The scenario is basically this... I do a PerformClick on a "Submit" button. Immediately on hitting submit a "Message from webpage" pop up box appears. However, the code will not continue to execute, it will stay on the "PerformClick" line of code indefinitely (it has been almost 15 minutes now that I've let it sit there and still it has not advanced).

If I use click, there is no problem. If I use PerformClick and change it so I don't get the "Message from webpage" pop up, there is no problem.

However, in the conditions above, the code will not proceed and we can repro it every time.

I'm not sure what the correct solution should be here... but at the very least PerformClick should "give up" waiting for a response or whatever it's doing. It would be nice if we have a choice whether or not that results in an exception (in my case I wouldn't want one, since PerformClick did its job as far as I'm concerned.

Thanks!

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Bug: PerformClick waits indefinitely if no response...

Post by krstcs » Thu Jul 24, 2014 9:31 pm

I'm not sure this is an issue on Ranorex's side.

The PerformClick is an INVOKE action on the remote object, and it has to wait for the remote object to return before it can continue.

If your button is not returning after the click event, that is a issue with the button, not Ranorex. (It may not be a problem or bug, just that the issue is with the invoked object not returning.)

My guess is that your button pops up the dialog and waits for the dialog to be dismissed before it finishes it's event handler method. That may be (and probably is) exactly what is required, so you will need to Click() the button instead of using the Invoke.PerformClick() on it.
Shortcuts usually aren't...

carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Re: Bug: PerformClick waits indefinitely if no response...

Post by carsonw » Fri Jul 25, 2014 4:37 pm

You're right - the fact that Ranorex doesn't get a response back is not an issue with Ranorex, but the fact that Ranorex never times out while waiting for that response back is an issue with Ranorex.

Using Click doesn't always work on all test machines for us (I'm not really clear why, but generally it's the slower machines), so we have to use PerformClick more often than we'd like.

Ranorex should give up after a period of time if no response is received... waiting indefinitely is the bug.

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Bug: PerformClick waits indefinitely if no response...

Post by krstcs » Fri Jul 25, 2014 5:06 pm

Invoke actions cannot have a timeout due to how they work. They are a direct call into the remote object's internal methods. There is no way for Ranorex to make a timeout, their calling method has to release control to the called method, which is the button's OnClick event, or similar, which means that Ranorex is then at the mercy of the called method. Timing this out would cause exceptions and SYSTEM (not just software) instability, and possibly (probably) blue screens due to remote procedure call mechanics.

If you need a timeout, you should figure out why Click() is not working and get that fixed and use it instead.
Shortcuts usually aren't...

carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Re: Bug: PerformClick waits indefinitely if no response...

Post by carsonw » Tue Jul 29, 2014 4:34 pm

Really? Because if I invoke the javascript (using executescript) then there's no problem.

As to why "Click" doesn't work - that's a larger mystery. My guess is that there's some sort of lag on the machines themselves (we use a lot of VMs because we have many, many tests environments), but tracking that down is a huge effort with potentially no pay off.

I still maintain it's not correct that Ranorex will wait indefinitely for a response (assuming that is what's happening) - I guess my technical knowledge is too limited because I don't understand why having a timeout waiting for a response could destabilize the entire system.

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Bug: PerformClick waits indefinitely if no response...

Post by krstcs » Mon Aug 04, 2014 1:30 pm

Sorry for the late response, I was out with pneumonia last week.

Note that I could be wrong on how Ranorex does it, it is just my understanding of how their stuff works.

As for the instability, if you have a one process calling another (what is called a Remote Procedure Call or RPC) and the calling object stops waiting for the response from the called method, the called method might try to write to an area of memory that is no longer allocated for the task it was attempting to call. This could just mean it writes to an unused memory area, but it could also mean that it overwrites an important structure. Then, when that area is needed by the actual owner, it will cause that owner to malfunction, and if the owner is the system, that means a blue-screen.
Shortcuts usually aren't...

carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Re: Bug: PerformClick waits indefinitely if no response...

Post by carsonw » Thu Aug 21, 2014 10:55 pm

Well I very much appreciate you taking the time to respond! It's above and beyond the call of duty.

It would be nice to hear back from Ranorex so we could both know for sure what's happening. I'm bringing it up again because I am once again running into this problem and it's really frustrating.

In this case I have a webpage that supports a file upload. So you click "Browse" and a standard windows dialogue box appears to select the file you wish to upload.

Unfortunately, "Click" and "DoubleClick" does not work reliably in all environments with all browser settings. So... now I'm using PerformClick and have the same issue. As soon as PerformClick is executed the file dialogue opens as expected and Ranorex just stops and waits for all time.

Now I could try and run the javascript myself to invoke a click action against that object but it's not feasible because of the way our solution is architected (it would be really involved to explain it). Secondly, I should not have to do this. I should be able to invoke PerformClick and reasonably expect that it does that and carries on.

Now, I'm stuck. I either have to put in a terrible, convoluted hack to make it work, or I can keep complaining to Ranorex to have them at least explain why using their PerformClick will not work (but executing the javascript does) and/or (preferably) fix it so it does actually work.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Bug: PerformClick waits indefinitely if no response...

Post by Support Team » Wed Aug 27, 2014 4:05 pm

Hi all,

It seems that this problem is not specific to Ranorex since the PerformClick()-method works in the same way as the standard HtmlElement.Click()-method. A possible workaround is either to use a normal Mouse.Click() action or a JavaScript function which executes the click asynchronously:

Code: Select all

setTimeout(function(){ document.getElementById('yourId').click(); }, 0)
Thank you for your understanding.

Regards,
Markus (S)