Click event is unreliable and does not work in some cases

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
iqbalhyd
Posts: 10
Joined: Mon Jan 19, 2015 4:32 am

Click event is unreliable and does not work in some cases

Post by iqbalhyd » Mon Jan 19, 2015 4:56 am

Hi All,

The click event on Ranorex text object is unreliable; it works on one machine but consistently does not work on other machine.

Ranorex version: 5.2.0
Application: WPF
OS: Windows 7 Enterprise (64 bit) Service Pack 1
CPU: Intel Zeon X5650

The Test is being written in C# test application where all tests are written as MS Unit test.

Below is the code performing the test
Text fileItem = "/form[@name~'^ReMetrica\\ Version\\ 7\\.0\\ Alp']/?/?/text[@name='Open']";
rmMain.MainMenu.File.Click();
fileItem.Click();


The test works if a) I manually click on the item during test is waiting for click b) write Keyboard.Keypress(“{enter}”); after performing click in the code

I also have attached the snapshot

Regards,
Iqbal
You do not have the required permissions to view the files attached to this post.

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

Re: Click event is unreliable and does not work in some cases

Post by krstcs » Mon Jan 19, 2015 2:43 pm

Seems to be a timing issue. It sounds like the click is working but the system under test just isn't ready for the mouse click yet.

Try adding a Validate.Exists( or WaitFor.Exists) against the text object just before the click.

It would be something like this:

Code: Select all

Text fileItem = "/form[@name~'^ReMetrica\\ Version\\ 7\\.0\\ Alp']/?/?/text[@name='Open']";
rmMain.MainMenu.File.Click();

Validate.Exists(fileItem);
fileItem.Click();


You could also add " and @enabled='true' " to your xpath in the element's attributes like this:

Code: Select all

Text fileItem = "/form[@name~'^ReMetrica\\ Version\\ 7\\.0\\ Alp']/?/?/text[@name='Open' and @enabled='true']";
That would force Ranorex to try to find only the item with the name='Open' and that is enabled.
Shortcuts usually aren't...

iqbalhyd
Posts: 10
Joined: Mon Jan 19, 2015 4:32 am

Re: Click event is unreliable and does not work in some cases

Post by iqbalhyd » Tue Jan 20, 2015 8:29 am

Thanks krstcs. I tried what you have suggest above and that does not work, tests are still failing.

Just to give some more background on this issue,
1) The tests are successfully working in developer machine(s) and on running in server, this issue pops out,
Especially most of the test failed on the click() method, Is there any difference in the way Ranorex works on click event in server?
2) This is a WPF based application and does there anything to be done with antivirus installed? Will antivirus have impact on Ranorex identification?
3) Another point to note is that the same tests are successfully running on the server few weeks ago and it was consistent, but from a specific day(around last week of December), this issue popped out and please note that there is no change made to the application or tests during these period? Or will there be any logs or dumps which is generated by ranorex, which might help to find the root cause?
4) Same test created and running from Ranorex studio is also inconsistent, means it fails and pass randomly.

looking forward to get help on this issue soon.

iqbalhyd
Posts: 10
Joined: Mon Jan 19, 2015 4:32 am

Re: Click event is unreliable and does not work in some cases

Post by iqbalhyd » Wed Jan 21, 2015 3:22 am

Can anyone help resolve this issue as I am pretty much stuck at this point, all of my tests are failing due to this issue and we can not progress further.

Let me know if this is a Ranorex bug in version 5.2.0? if yes is there any fix available somewhere?

iqbalhyd
Posts: 10
Joined: Mon Jan 19, 2015 4:32 am

Click event is unreliable and does not trigger sometime

Post by iqbalhyd » Wed Jan 21, 2015 3:56 am

The Ranorex click event is unreliable and does not trigger sometime, though it focusses on the text object but does not trigger event, this is a C# coded test application, below is the code:

Code: Select all

Text fileItem = "/form[@name~'^ReMetrica\\ Version\\ 7\\.0\\ Alp']/?/?/text[@name='Open']";
rmMain.MainMenu.File.Click();
fileItem.Click();
Following is the configuration:

Ranorex version: 5.2.0
Application: WPF
OS: Windows 7 Enterprise (64 bit) Service Pack 1
CPU: Intel Zeon X5650


1) The tests are successfully working in developer machine(s) and this issue pops out when running tests on server (above mentioned machine) especially most of the test failed on the click() method
2) Another point to note is that the same tests are successfully running on the server few weeks ago and it was consistent, but from a specific day(around last week of December), this issue popped out and please note that there is no change made to the application or tests during these period
3) Same test created and running from Ranorex studio is also inconsistent, means click event does not trigger sometime.
4) The test works if a) I manually click on the item during test is waiting for click b) write Keyboard.Keypress(“{enter}”); after performing click in the code

Note: I already have tried several things, please see my post on forum: http://www.ranorex.com/forum/click-even ... t7424.html


Regards,
Iqbal
Last edited by Support Team on Thu Jan 22, 2015 1:52 pm, edited 1 time in total.
Reason: Moved topic because of duplicity

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

Re: Click event is unreliable and does not work in some cases

Post by krstcs » Wed Jan 21, 2015 3:46 pm

1. Please do not make multiple posts about the same issue. If you believed this was a bug you probably should have created it in the bugs section first.

2. Click works fine for me in all environments and on all of my AUTs (Java, Web, WPF), so I highly doubt this is a bug.

3. It would be helpful if you could post a Ranorex Snapshot of the application in question as well as the test that is causing issues. Just posting a code snippet does not always show the root of the problem. You can find information about creating Ranorex Snapshots here.

4. You mention a server, but the only operating system that you list is Windows 7 Enterprise, which is not a server operating system. Could you tell us which server OS you are using?
Shortcuts usually aren't...

iqbalhyd
Posts: 10
Joined: Mon Jan 19, 2015 4:32 am

Re: Click event is unreliable and does not work in some cases

Post by iqbalhyd » Thu Jan 22, 2015 7:52 am

Apologize about duplicate post to make you confuse.

As I have mentioned earlier, we have coded tests written in C#, therefore there is no snapshot possible, I have attached one of the failing tests.

Team Foundation server (running on a separate server machine) build the tests and app, then copy the build to windows 7 machine and then run the test there.

What is the next step? how Ranorex team will fix this bug if can not reproduce?

I can let you run through on my environment using screen share where the test is failing if you want.
You do not have the required permissions to view the files attached to this post.

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

Re: Click event is unreliable and does not work in some cases

Post by krstcs » Thu Jan 22, 2015 5:54 pm

The Ranorex Snapshot is a file that contains the structure of your application under test. If you read the page I pointed you to, you will see that you only need Ranorex Spy to make one.
Shortcuts usually aren't...

iqbalhyd
Posts: 10
Joined: Mon Jan 19, 2015 4:32 am

Re: Click event is unreliable and does not work in some cases

Post by iqbalhyd » Fri Jan 23, 2015 8:33 am

Hi Krstcs,

I have attached the snapshot, please have a look and let me know if there is anything else you need.

Regards,
Iqbal
You do not have the required permissions to view the files attached to this post.

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

Re: Click event is unreliable and does not work in some cases

Post by krstcs » Fri Jan 23, 2015 2:27 pm

Your application does not contain an element that matches the given XPath. You need to make sure the XPath to the element in question is correct, that is the problem.
Shortcuts usually aren't...

iqbalhyd
Posts: 10
Joined: Mon Jan 19, 2015 4:32 am

Re: Click event is unreliable and does not work in some cases

Post by iqbalhyd » Mon Jan 26, 2015 3:43 am

please let me know what element is missing and in which xpath? the same app is working fine on any other machines

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

Re: Click event is unreliable and does not work in some cases

Post by krstcs » Mon Jan 26, 2015 4:16 pm

All I can tell you is that the XPath you provided does not match any elements in the Snapshot you posted. Either you posted the wrong snapshot, or you posted the wrong XPath. Please figure out which is not correct and re-post it.
Shortcuts usually aren't...

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

Re: Click event is unreliable and does not work in some cases

Post by odklizec » Mon Jan 26, 2015 4:26 pm

Another suggestion, please post also the snapshot from the system where it works, so we can check the differences.
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

lila
Posts: 21
Joined: Wed Jun 18, 2014 10:17 am

Re: Click event is unreliable and does not work in some cases

Post by lila » Thu Feb 05, 2015 3:24 pm

We are facing the same issue that Iqbal is facing above. This issue occurs very randomly and at various stages of script application.

There is no issue with the Xpath of the object because it works fine when I run it in development machine but if the same script is ran in the test machine it fails. If there is issue with Xpath then the script should fail in the development machine.

For example : I have used the same method called user creation five times in my script , the issue will occur when the third user is being created and the object for which the click function was used is very much available on screen.

I am assuming this should be a potential Ranorex issue which definitely needs a fix.

Thanks

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

Re: Click event is unreliable and does not work in some cases

Post by krstcs » Thu Feb 05, 2015 3:50 pm

I would suggest that you use Ranorex Spy to look at the path on the test system and make sure it is actually the same as on the development system.

The XPath can change due to deployment requirements. For example, if you have a web-based app, the domain may change based on the environment that you are building it to. If your XPath is based on the domain then it would fail in the test environment because it is different than the development environment.

Again, please verify that the XPath is the same on both systems using Ranorex Spy.
Shortcuts usually aren't...