With Windows 8 a new tile based user interface, called Windows 8 Style UI (formerly known as Metro-style), will be shipped. This blog post will provide some useful tips and tricks concerning automating Windows 8 Style UI apps using Ranorex.

Automate Win 8-stlye UI Apps


The below instructions are only valid for Ranorex 3.X and lower. Ranorex 4.0 (and higher) makes automating Windows UI apps a lot easier and the guidelines in this blog should not be needed.
If you still have problems automating your Windows UI app with Ranorex 4.0 (and higher), have a look at the troubleshooting help in the Ranorex User Guide:
Troubleshooting for automating Windows Apps

 

Things to consider

It’s recommended to disable UAC as well as starting Ranorex with administrator privileges.

Run Ranorex as Administrator

To open the new tile based start page, the windows key is used. To automate opening the start page, simply add a “Key Shortcut” action with the “{LWin}” as key code.

Add Key Sequence Action to start Win 8-style UI

As ensure visible might (currently) slow down automation, it’s recommended to disable the option “Use ensure visible by default” in general settings.

Uncheck "Use Ensure Visible" in general settings

Ranorex does currently not support touch events for windows based operating systems. But you can use keyboard shortcuts to access touch based functionality, for example opening the Charms menu.
Have a look at the following subset of useful shortcuts:

  • Win + C – brings up the Charms menu, where you can search, share, and change settings.
  • Win + I – opens the Settings panel, where you can change settings for the current app, change volume, wireless networks, shut down, or adjust the brightness.
  • Win + Z – opens the App Bar for the current application.
  • Win + H – opens the Share panel.
  • Win + Q – brings up the App Search screen.

If you have problems with recording your Windows 8-style UI, we recommend to manually create your recording using the Ranorex Spy to fill your repository. For further information have a look at our blog post “Did you know… that you can manually generate a recording?”.

If you are going to track Windows 8-style UI controls, it’s recommended to use the stand-alone Ranorex Spy and select the option “Always On Top”. With the Ranorex Studio internal Spy it’s not possible to have both the Spy and the Windows 8-style UI opened at the same time.

Spy "Allways On Top"

If you are going to shorten a RanoreXPath, it’s recommended to use the optional location step operator “?” instead of using the “find all descendants” operator “//” because of a better performance. Have a look at the RanoreXPath section of our user guide to get more information about editing the RanoreXPath.

To shorten the generated RanoreXPath, it’s recommended to use Path Weight Rules to eliminate the use of the attribute “automationid” with UIAutomation controls for certain values (which are autogenerated and not robust for object recognition) and the use of the attribute “id” of some specific webelements:

To add the path weight rules to your configuration you simply have to step through the following instructions:

  1. Copy following xml code to your clipboard:
    
    
    
    
  2. Open the path weight editor:
    Edit Path Weigths
  3. And paste the copied rule from your clipboard:
    Copy Paste Path Weight Rules

After doing so, the added path weight rules should look like the following:

Add RanoreXPath Weight Rule for webelement

Please note that if a Windows 8 UI-style app is in the background, it’s not accessible until it comes back to foreground, because it’s getting suspended.

 

Conclusion

As you can see, by keeping in mind the mentioned tips and tricks, you should not run into problems with automating Windows 8-style UI apps using Ranorex.
Nevertheless, we are working on improving the usability and speeding up the automation process as well as implementing support for touch-based automation.

You might also like these articles