Page 1 of 1

Repo item found but not clicked on

Posted: Tue Jun 13, 2017 4:10 pm
by mzydorczyk
Hi

Ranorex 7.0.1
Windows 2012 R2 server with all updates available.

I am automating an application that is made in WPF and seem to have the same issue when automating things in expandable/collapsable "trees" (I attached screenshot example).

Ranorex is able to find the item I want to click or double click on and highlights it fine but it won't click on it. The module ends and it says it ran successfully but it didn't.

Here is the test/module breakdown:

1) Click on tree item.
2) NEXT button will enable.
3) Click on NEXT button.

What actually happens is you can see ranorex selects the item I want to click on because it is highlighted in blue but the NEXT button stays unenabled like the tree item was never clicked on. When I do all this outside of ranorex it just works as expected. With ranorex it stumbles. Another interesting thing is if I right click on the item in the repo and click "Highlight Element" it will bring the application to the foreground with the item highlighted but if I then click on it, it won't enable the NEXT button. So when ranorex is identifying the item it seems to be messing something up.

Any ideas why it's acting this way?

Re: Repo item found but not clicked on

Posted: Tue Jun 13, 2017 9:41 pm
by Support Team
Hi mzydorczyk,

Is it possible for you to provide a snapshot of your application? This would greatly help us understand your application's structure and give us more insight on the control(s) in question.

You could also try an Invoke Action-> PerformClick() as this will still click the item but in a different way. It will essentially tell your application that the object has been clicked on which should fire all related event handlers. You should not see the mouse physically move to the object to click it, but the click will still occur with the Invoke Action.

Hope this helps!

Regards,
Jon

Re: Repo item found but not clicked on

Posted: Wed Jun 14, 2017 2:02 pm
by Vaughan.Douglas
In my experience this is due to Ranorex moving too fast.

Without more specific details, I can suggest a few methods to get the synchronization on track.
  • Check the status of the enabled attribute in the RxPath. //button[@innertext='next' AND @enabled='true'] This will make Ranorex unable to locate the Next button until that specific attribute resolves to true
  • Add a "move to" step to physically move the cursor to the Next button before trying to click on it.
    This just literally slows execution down
  • Invoke the PerformClick() as mentioned, just remember this is not functionally the same as actually clicking on the object
  • As a last resort Insert a delay. This might be something I'd try first to validate it's a timing issue, but I don't like hard waits in my automation.
  • If this is a webpage, make sure you set the state attribute of the DOM to 'complete' dom[@state='complete']

Re: Repo item found but not clicked on

Posted: Wed Jun 14, 2017 2:20 pm
by Stub
I often use that "and @enabled='true'" trick that Vaughan.Douglas mentions in combination with WaitForExists/WaitForNotExists, so that I can pause my test until a thing I need occurs. Very useful, and definitely improves reliability. I favour this approach over inserting Delays too.

Re: Repo item found but not clicked on

Posted: Thu Jun 15, 2017 7:42 am
by mzydorczyk
In my experience this is due to Ranorex moving too fast.

Without more specific details, I can suggest a few methods to get the synchronization on track.

Check the status of the enabled attribute in the RxPath. //button[@innertext='next' AND @enabled='true'] This will make Ranorex unable to locate the Next button until that specific attribute resolves to true
Add a "move to" step to physically move the cursor to the Next button before trying to click on it.
This just literally slows execution down
Invoke the PerformClick() as mentioned, just remember this is not functionally the same as actually clicking on the object
As a last resort Insert a delay. This might be something I'd try first to validate it's a timing issue, but I don't like hard waits in my automation.
If this is a webpage, make sure you set the state attribute of the DOM to 'complete' dom[@state='complete']
I often use that "and @enabled='true'" trick that Vaughan.Douglas mentions in combination with WaitForExists/WaitForNotExists, so that I can pause my test until a thing I need occurs. Very useful, and definitely improves reliability. I favour this approach over inserting Delays too.
I think the problem with these solutions though is that the issue is not with clicking on the next button. It's that when I click on the "actions" element it should enable the next button. So I don't think it's an issue of speed. The next button just isn't getting enabled at all. If I manually do the clicking it works just fine.
Is it possible for you to provide a snapshot of your application? This would greatly help us understand your application's structure and give us more insight on the control(s) in question.

You could also try an Invoke Action-> PerformClick() as this will still click the item but in a different way. It will essentially tell your application that the object has been clicked on which should fire all related event handlers. You should not see the mouse physically move to the object to click it, but the click will still occur with the Invoke Action.
Can you point me to any info on perform action? I don't see a "PerformClick()" method to choose from. I will send my snapshot in the morning (for me).

Re: Repo item found but not clicked on

Posted: Thu Jun 15, 2017 1:13 pm
by mzydorczyk
Jon, where can I send my snapshot so that I don't have to upload it here? Thank you.

Re: Repo item found but not clicked on

Posted: Thu Jun 15, 2017 2:19 pm
by Vaughan.Douglas
mzydorczyk wrote:I think the problem with these solutions though is that the issue is not with clicking on the next button. It's that when I click on the "actions" element it should enable the next button. So I don't think it's an issue of speed. The next button just isn't getting enabled at all. If I manually do the clicking it works just fine.
The speed issue has to do with Ranorex identifying and acting on that next button after clicking on the "actions" element but before the page actually activates that next button. We're talking milliseconds. The result is that it gets "clicked" but since it wasn't activated it looks like it's just received focus or something. Try throwing a one second delay between the two steps and see if it resolves the issue. If it does, refine it using one of the suggested methods above.
mzydorczyk wrote: Can you point me to any info on perform action? I don't see a "PerformClick()" method to choose from. I will send my snapshot in the morning (for me).
PerformClick can be found under "invokeAction" if you're using the recorded modules. I use this method regularly, but you need to know that it is NOT the same as a user clicking on the button. For example if there was a problem with the app where clicking the "actions" button doesn't actually activate that "next" button, using perform click could still trigger the onclick event.

Like I said, I use invoked actions all the time. You just need to understand what your actually doing.

Re: Repo item found but not clicked on

Posted: Thu Jun 15, 2017 3:51 pm
by mzydorczyk
I think I'm still not being clear. I appreciate both of your feedback on the issue. However, this is the issue again.

Action: Click on the "Actions" element.
Event: Next button/element will enable.

The problem is this is not happening. You have mentioned multiple times about the next button being clicked on but thats not what I'm talking about. We can take away any issue with clicking on the next button. Lets say I don't even want to click on it. All I want to do is make sure it's enabling the next button. Now yes I know how to make validation to "test" for that. But the issue is when ranorex "clicks" on "Actions", the next button doesn't enable and when I click on "Actions" it does enable. So theres some kind of disconnect between ranorex's "click" and my finger clicking. Does this clear it up or are we in the same place?

Re: Repo item found but not clicked on

Posted: Thu Jun 15, 2017 4:13 pm
by Vaughan.Douglas
mzydorczyk wrote:Jon, where can I send my snapshot so that I don't have to upload it here? Thank you.
I believe the support email is [email protected]. Without that, we're kinda grasping at straws. Sorry this didn't get answered sooner.

Re: Repo item found but not clicked on

Posted: Thu Jun 15, 2017 4:18 pm
by Vaughan.Douglas
mzydorczyk wrote:I think I'm still not being clear. I appreciate both of your feedback on the issue. However, this is the issue again.

Action: Click on the "Actions" element.
Event: Next button/element will enable.

The problem is this is not happening. You have mentioned multiple times about the next button being clicked on but thats not what I'm talking about. We can take away any issue with clicking on the next button. Lets say I don't even want to click on it. All I want to do is make sure it's enabling the next button. Now yes I know how to make validation to "test" for that. But the issue is when ranorex "clicks" on "Actions", the next button doesn't enable and when I click on "Actions" it does enable. So theres some kind of disconnect between ranorex's "click" and my finger clicking. Does this clear it up or are we in the same place?
This does help clarify, but it doesn't necessarily preclude a timing issue. I'm not an expert on WPF stuff, so I can't make any blind suggestions beyond that. Please let us know if you get a resolution through Ranorex Support.

Re: Repo item found but not clicked on

Posted: Tue Jun 20, 2017 7:27 pm
by Support Team
mzydorczyk wrote:Jon, where can I send my snapshot so that I don't have to upload it here? Thank you.
Hi mzydorczyk,

Sorry for the delay as I was out of office until today. As Vaughan.Douglas suggested, it would be best to email either [email protected] [US Team] or [email protected] [European Team] if you do not want your snapshot hosted publicly on this forum. If you do end up submitting a ticket, please reference this forum post as well in your ticket.

In regards to perform click, it is accessed by Invoke Action -> Perform Click:

Image

And if you are working in code, you should just be able to use the .PerformClick() method on your repository item(s).

Hope this helps!
Jon

Re: Repo item found but not clicked on

Posted: Wed Jun 28, 2017 5:17 am
by mzydorczyk
Somehow I don't get the PerformClick() invoke action to show up like you show, in studio. I will try to do it using user code but wanted to get a reply out.

Alternatively, each element/item in the repo get highlighted with a "box" when it's identified and that box represents the "area" i guess you could say, of that element. For this problem I was thinking maybe since clicking in the "Action Spot" doesn't seem to be working using the predefined options, maybe clicking on a specific location would work. How would I go about clicking in a certain location of an element?

I discovered element.location.x and element.location.y to get the x and y coordinates but I'm not quite sure how to use them. Would this accomplish clicking in a specific location inside an element?

Re: Repo item found but not clicked on

Posted: Wed Jun 28, 2017 8:10 am
by Stub
In User Code I use Click(Location.CentreRight) for example. Click() by default assumes Location.Centre. Since Location.CentreRight is proportional, sometimes when I want to click towards the right-hand edge, say, I'll calculate a coordinate:

Code: Select all

RepoItemInfo combo_info...
:
Ranorex.ComboBox combo_ctrl = combo_info.CreateAdapter<Ranorex.ComboBox>(true);
Rectangle combo_rect = combo_ctrl.Element.ClientRectangle;
Point drop_arrow_pt = combo_rect.CentreHardRightClient();

combo_ctrl.Click(new Location (drop_arrow_pt));
CentreHardRightClient is an extension method of Rectangle that calculates a point just inside the right-hand edge.

Re: Repo item found but not clicked on

Posted: Wed Jun 28, 2017 9:01 pm
by Support Team
Hi mzydorczyk,

You likely can't use perform click because the specific object you are working with does not have that capability. The Actions context menu for Ranorex is smart and will only display options applicable for that object type.

Please try the following:
  • -Find the object you wish to use PerformClick() on in your repository
    -Drag the element from the repository up to your action table where all the steps for your recording are
    -Release the mouse button to drop the repo object on the action table
    -This should bring up the smart context menu which should have the Invoke Action category availible
    -Depending on the type of object, you should be able to select PerformClick()
    -Once you select the desired action, the step should be created for you within the action table
I looked at your support ticket which was Handled by one of our support engineers. The problem was stated as having to do with your application's unique WPF structure. If you are still experiencing issues please let me know and I will be happy to assist you!

Hope this helps!
Jon