How to speed up clicks

Best practices, code snippets for common functionality, examples, and guidelines.
MichaelB
Posts: 3
Joined: Thu Jun 01, 2017 9:39 pm

How to speed up clicks

Post by MichaelB » Tue Apr 10, 2018 9:04 pm

Button clicks during my playback are taking at least 3 seconds on average. I played with different settings (including the ones below), but with no luck. Please see below and the attached snapshot for more details.

Operating System: Windows 10 64bit
Ranorex version: 8.1.0+git.31425ebc
Mouse.DefaultMoveTime = 300;
      Keyboard.DefaultKeyPressTime = 100;
      Delay.SpeedFactor = 1.0;	

     SystemLibrary.StartTimer("Click Settings Button");
     Repo.MainForm.LoginPrompt.btnSettings.Click();
     SystemLibrary.StopTimer("Click Settings Button");


Here is the output

00:07.761 Info User

00:07.764 Info Timer Started: 'Click Settings Button'
00:12.560 Info Timer Stopped: 'Click Settings Button' (duration: 4.7976693 seconds)

Any suggestion?

Thanks
Attachments
SettingsButton.rxsnp
Button Snapshot
(176.15 KiB) Downloaded 11 times

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

Re: How to speed up clicks

Post by odklizec » Wed Apr 11, 2018 9:00 am

Hi,

Please post the xpath for given "Settings" button (as stored in repository). Typically, the delay between actions is caused by search time, during which Ranorex is trying to find the element in question (based of its repo xpath). If the xpath is not enough specific (or too general), it may take some time to find the element. Hence the click action may be delayed.
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

MichaelB
Posts: 3
Joined: Thu Jun 01, 2017 9:39 pm

Re: How to speed up clicks

Post by MichaelB » Wed Apr 11, 2018 3:10 pm

Hi odklizec,
thanks for the reply

Here is the XPath
.//element[@automationid='clientControl']/element[@automationid='loginView']/element[@automationid='outline']/button[@automationid='settingsButton']

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to speed up clicks

Post by Support Team » Fri Apr 13, 2018 3:07 am

Hi,

Pavel hit the nail on the head with the explanation. Usually, most of your time on an action is spent searching for the object as Ranorex works with live objects. Looking at your path I can spot a potential issue:

.//element[@automat...

The ".//" essentially tells Ranorex to check every parent level object within the application tree of Ranorex Spy and every ancestor of those objects for your path. There is definitely a time and place to use ".//" as it can provide a high level of robustness, but you need to be aware it will likely affect performance. You may test the effects of having ".//" in the front of your RanoreXPath:

[1] Open Calculator from the Windows Start Menu (Start --> "Calc")
[2] Track any button using Ranorex Spy
[3] Add ".//" to the beginning of the path and press enter (Take note of the time it takes to find the button. The more applications / windows you have open, the longer it may take)
[4] Now try removing the ".//" and press enter (The object should be found much faster)

Again this combination of operators can make your RanoreXPath extremely stable even through application changes but at the cost of speed. The second way you can affect click speed is by adjusting the timeouts within the module:

Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;

You may also adjust the speed in a recording module by changing the settings.

You could turn these down for more speed but we generally recommend leaving them as is if you want to test more like an average user. If your application under test is heavy and lacks responsiveness, be conservative with these values as it may be too fast for your application to respond to. You could try the default path that Ranorex Spy generated:

/form[@controlname='MainForm']//element[@automationid='clientControl']/element[@automationid='loginView']/?/?/button[@automationid='settingsButton']

You have some pretty cool and powerful options with RanoreXpath (like finding all buttons with one path) and if you would like to learn more about RanoreXPath, I would highly recommend checking out the below links:

https://www.ranorex.com/help/latest/ranorexpath
https://www.ranorex.com/blog/ranorexpat ... nd-tricks/

I hope this helps!

-Jon
.
Image

MichaelB
Posts: 3
Joined: Thu Jun 01, 2017 9:39 pm

Re: How to speed up clicks

Post by MichaelB » Mon Apr 30, 2018 11:52 pm

Hi Jon,
thanks for your reply. So yeah we've already tried a variation of the xpath with another ranorex support rep, but the speed hasn't improved. It seems like this may have something to do with the technology we're using in our app. We investigating it. Thanks for the tips though