Mouse click on button not consistently working

Ask general questions here.
Posts: 1
Joined: Wed May 25, 2016 5:33 pm

Mouse click on button not consistently working

Post by relimed » Thu Jun 23, 2016 5:02 pm


Just getting started with Ranorex with our Windows desktop application and using a Validation step for the button before the mouse click. However, even though Ranorex is reporting successful validation and the mouse click, it is not registering with our app every time.

00:03.296 Info Validation

Validating AttributeEqual (Text='Continue') on item 'SelectCustomerDialog.ButtonContinue'.
00:03.593 Success Validation

Attribute 'Text' of element for item 'ReLiMedMasterRepository.SelectCustomerDialog.ButtonContinue' does match the specified value.
00:03.718 Info Mouse

Mouse Left Click item 'SelectCustomerDialog.ButtonContinue' at 47;14.

Should I try a wait for or can I change the location to "Center"? I tried changing location of click to Center but it did not save.

This is happening for all buttons I have tried so far.


Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Mouse click on button not consistently working

Post by stapes » Fri Jun 24, 2016 3:37 pm

It might be worth checking the 'Enabled' state of the button. You can add and @enabled='true' to the repo item xpath or wait for enabled==true in your code.

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

Re: Mouse click on button not consistently working

Post by krstcs » Fri Jun 24, 2016 4:40 pm

It sounds like the button text is changing as well.

I would suggesting, instead of using a validation step, that you create a copy of the repo element and add "and @enabled='true' and @text='Continue'". You can have as many copies of the same element as you want as long as the names are different, and you can adjust each one's path to look at different properties of the element, so you could have something like this:

Assume you have a single button (in a parent container with id='myContainer') that changes names, the following button repo items can all point to it, depending on the state of the button. The first would be used to validate properties because it is generic, the other two would be used to make Ranorex only find the element if they have the specified text value.

Code: Select all

Container => //container[@id='myContainer']
----Button          => /button
----Button_OK       => /button[@text='OK']
----Button_Continue => /button[@text='Continue']
Shortcuts usually aren't...