locked
UI automation tool for metro-style app RRS feed

  • Question

  • I implemented a test automation tool by C#, it uses UIA to find a windows and returns AutomationElement instance(s). I am wondering how to extend this tool to find metro-style app's window(s). 

    it seems to me that Windows.UI.Xaml.Automation is the namespace to start with, however, there is no method like FindAll(...) to find a windows by specified AutomationElementIdentifiers.

    is there any material for my reference? 


    myang
    Monday, September 26, 2011 8:49 AM

Answers

  • Are you trying to write the automation client as a Metro style app or are you trying to automate a Metro style app from a desktop automation client?

    A desktop client with the uiAccess permission (http://msdn.microsoft.com/en-us/library/ms742884.aspx ) can use UIA to examine Metro style apps.  Windows.UI.Xaml.Automation defines properties to expose a Metro style app to automation clients, but it doesn't include the AutomationElement class needed to implement an automation client directly.

    The Developer Preview comes with inspect.exe and accevent.exe in C:\Program Files (x86)\Windows Kits\8.0\bin\x86 as examples of desktop UIA clients which can view and automate Metro style apps.

    --Rob

     

    • Proposed as answer by Jie Bao Tuesday, September 27, 2011 5:30 AM
    • Marked as answer by myang Tuesday, September 27, 2011 2:25 PM
    Tuesday, September 27, 2011 12:29 AM
    Moderator

All replies

  • Are you trying to write the automation client as a Metro style app or are you trying to automate a Metro style app from a desktop automation client?

    A desktop client with the uiAccess permission (http://msdn.microsoft.com/en-us/library/ms742884.aspx ) can use UIA to examine Metro style apps.  Windows.UI.Xaml.Automation defines properties to expose a Metro style app to automation clients, but it doesn't include the AutomationElement class needed to implement an automation client directly.

    The Developer Preview comes with inspect.exe and accevent.exe in C:\Program Files (x86)\Windows Kits\8.0\bin\x86 as examples of desktop UIA clients which can view and automate Metro style apps.

    --Rob

     

    • Proposed as answer by Jie Bao Tuesday, September 27, 2011 5:30 AM
    • Marked as answer by myang Tuesday, September 27, 2011 2:25 PM
    Tuesday, September 27, 2011 12:29 AM
    Moderator
  • Thank Rob. your answer is a big help!

    1. I find inspect.exe can exist on legacy desktop and metro style desktop (i launch inspect.exe on legacy desktop, after switch to metro style desktop, inspect.exe shows up on metro style desktop, if this is by design, how can i let my app has the same behavior (inspect.exe is not a metro style app, how can it shows up on metro style desktop)?

    2. Launch inspect.exe on legacy desktop, inspect.exe display all legacy desktop's window(s), then I switch from legacy desktop to metro style desktop, inspect.exe display all windows of "both" legacy and metro style desktops. is this correct behavior?

    3. is there any material about the relationship between legacy and metro style desktop?

     


    Michael
    Tuesday, September 27, 2011 2:46 PM
  • Hi, Michael,

    (1) -- this is a behavior specific to accessibility tools and utilities.  It is best not to do this for test automation tools. 

    (2) -- Yes, this is the correct behavior.  Desktop windows have always continued to exist when they are running in the background, and we've preserved this behavior in Windows 8.  But metro-style apps have a different model -- they are not interactive when they are not running in the foreground.  So, Inspect will not show them on the legacy desktop.

    (3) -- Not sure on this one -- I don't know of any, yet, but that doesn't mean it's not out there.

    Thanks,
    Michael


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, September 30, 2011 4:11 PM
  • Our group is trying to figure out a way to automate metro App UI testing.

    Is there a tool that enables us?

    If not do 'Automation APIs' provide full support to develop such a tool. I can see MSFT developed two, but as an end user can I develop one using existing APIs.

    Thanks

    PB

     


    • Edited by __PB Tuesday, October 4, 2011 9:37 PM
    Tuesday, October 4, 2011 8:45 PM
  • hi, PB

    i think you can implement by UIA (http://msdn.microsoft.com/en-us/library/ms747327.aspx).

     

    Hi, all

    i am looking for a mechanism which i can implement to simulate "touch" behavior, any idea?

     


    Michael
    Monday, October 10, 2011 1:46 PM
  • You can simulate touch behaviour in Windows 8 (You can download the 'Windows 8 Developer Preview with developer tools English' from here). Take a look at the Touch Injection sample here.

     

    Thanks,
    Pushkar

    Tuesday, November 8, 2011 4:18 AM
  • Comment on non-public build deleted

    This forum is for discussion of the publically available Developer Preview only. If you have a newer build under NDA please address all questions through the channel from which you received it.


    Friday, February 17, 2012 6:29 AM
  • Hi,

    I'm looking for documents written about window 8 apps automation. Is there any?

    is there any sample code done using Dev11?

    Thanks,

    Mohd


    mohdkhairi

    Friday, February 17, 2012 5:53 PM
  • Are you able to find some samples on this?

    -Hitesh

    Friday, March 23, 2012 8:45 PM
  • not yet. Still looking

    mohdkhairi

    Friday, March 23, 2012 9:07 PM
  • there are few mentioned here. But I couldn't find the solution files/zip for the sample. Please see if you could locate them.

    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/aa358520.aspx

    Tuesday, March 27, 2012 5:42 PM
  • Hi all,

    Here is my case:

    I have a Metro-style app (written in C#) which I want to automate by another desktop app also written in C# (let's call it a Desktop Automation Client - DAC).

    Currently my DAC cannot see a "window" of my Metro app. In that topic I read that I have to set some security settings in DAC. In fact I don't know where/how to set this. I need some help here, please.

    Assuming above step is done, will it be enough to see Metro app "window" by my DAC? If not, what should I do more to be able control Metro app from DAC?

    Best regards,

    Jiraiya

    Saturday, March 31, 2012 7:15 PM
  • Dear All,

    Is it possible to write a "Metro" style app to automate "Metro" style app or desktop app?The reason why I do so is because my auto test programs need to run on both ARM or x86 CPU.

    Since I begin to try Metro app, I just find out that I can't use AutomationElemnt to get what I want to control in Metro Style App.

    (but it doesn't include the AutomationElement class needed to implement an automation client directly.)

    Do you have any suggestions?

    Sorry to post my question in this old thread.

    Hope you can give some suggestions.

    Thanks. :)

     

     

    Thursday, April 26, 2012 11:13 AM
  • Hi, Milton,

    This is not possible.  Metro style apps run in an AppContainer, which carefully controls their access and privileges to avoid any unwanted side effects on the rest of the system.  All interactions between a Metro style app and anything else on the system are controlled through contracts like Share and Clipboard. 

    So, to have a Metro style app be able to run UI automation code and manipulate other apps would be contrary to the spirit of what Metro style apps should be able to do.  [Imagine a Metro style app using UIA to sniff credit card numbers out of another Metro style app!]

    Thanks,
    Michael


    This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, April 26, 2012 3:13 PM
  • Dear Michael,

    Got it.

    Thanks for your response. 

    Just want to hear more expert's suggestions.

    I'm now surveying any method that can help our tooling team to develop auto test programs to do some stress tests on Win 8 Tablet product.  (Include ARM or X86 CPU)

    The stress tests may imitate user behavior such as turn on or turn off Wifi/ BT settings 1000 times or take pictures 1000 times.

    In fact, under x86 environment we can find some tools to serve the purpose. (Include  UIA)

    But under ARM environment, I still have no clues now.

    The first thing come to my mind is to use UIA.

    However, it seems that I can't develop Metro App to control UI components in Win 8 RT (ARM CPU.)

    Do you have any advice what I should do to meet the need or do I misunderstand any concept of Win 8?

    Thanks for your great help. :)

    BR,

    Milton


    • Edited by Milton Wu Friday, April 27, 2012 3:09 AM
    Friday, April 27, 2012 2:27 AM
  • We have the same question.  We can write a  desktop accessibility application to control Metro apps, but how do we do this on Win8 RT (ARM) with a locked down desktop?  Some  clarity on this would be greatly appreciated.

    Thanks,
    hrp27

    • Proposed as answer by Micah Barwick Monday, March 11, 2013 8:32 PM
    Wednesday, May 2, 2012 3:56 PM
  • Are you trying to write the automation client as a Metro style app or are you trying to automate a Metro style app from a desktop automation client?

    A desktop client with the uiAccess permission (http://msdn.microsoft.com/en-us/library/ms742884.aspx ) can use UIA to examine Metro style apps.  Windows.UI.Xaml.Automation defines properties to expose a Metro style app to automation clients, but it doesn't include the AutomationElement class needed to implement an automation client directly.

    The Developer Preview comes with inspect.exe and accevent.exe in C:\Program Files (x86)\Windows Kits\8.0\bin\x86 as examples of desktop UIA clients which can view and automate Metro style apps.

    --Rob

     

    Hi Rob, How do I use accevent.exe and inspect.exe to automate my metro app. I understand that they can listen to all the events on the metro app. What I need to do is, I need to launch a metro app (I could automate this launching part but don't know how to proceed from here) and click a button, can I use inspect.exe or accevent.exe to do it? Please let me know.


    Cheers, Veena.


    • Edited by VeenaU Thursday, July 26, 2012 5:35 AM
    Thursday, July 26, 2012 5:35 AM