locked
How to click the element which doesnot support Invoke Patern

    Question

  • I have to do Automation Testing on metro App(C++) .I am Developing Automation(IAutomation) for the Metro UI.

    I am able to List all the element of the UI.

    I have a situation where ListemItem has a Image and Text field and If we click this it will open a webpage.

    Since ListItem,Text Field and Image doesn't have Invoke Pattern,I am facing difficult in Clicking it.

    I am using inspect.exe to analyze the Ui content.

    when i run the my metro app and then open Inspect.exe to check my Sample Metro App I found that clicakble point for ListItem,Image. but when try to get clickable point using

                    POINT clickable;
    BOOL gotClickable;

                   hr = p1->GetClickablePoint(&clickable,&gotClickable); I got gotClickable  = 0 and clickable value is also 0.

    Is there any way to clicking using IAutomation Interface.I am using C++ to develop Automation client.

    1. Please suggest me how I can Click the element which doesn't support Invoke Pattern

    2. we have two set of Api 1. IAutomation Interface 2. Windows.UI.Xaml.Automation ,How both are different from one another.Which one should be used for developing Automation client for Testing  metro Style App.

    Monday, August 13, 2012 7:41 AM

Answers

  • Yes, you need to change the app which is to be automation tested.

    The automation code is not useless in terms of functionality of the app: it is necessary for the app to be accessible.

    Depending on where you are and who your audience is, there may be legal requirements that your app be accessible. Regardless of whether it is required, it is a good idea.

    There are no other good solutions. You can come up with a hack, but I can't recommend one.

    --Rob



    Tuesday, August 28, 2012 2:59 AM
    Owner

All replies

  • I assume that by IAutomation you mean IUIAutomation and its related interfaces.

    1) You can't. InvokePattern is required for this. Your control should support the Invoke pattern if it is going to act invokable. This is important both for your test automation and for general accessibility. Since you have custom behavior here you don't get it automatically on those controls, so you will need to add it yourself by implementing a custom AutomationPeer. This is demonstrated in scenario #3 of  the XAML accessibility sample .

    2) IUIAutomation is the native interfaces for UI Automation clients (an accessibility app such as a screen reader or a test automation app) to manipulate and investigate UI Automation servers (apps which can be automated - in theory, everything). Windows.UI.Xaml.Automation is the implementation of the Automation servers for Xaml controls. Essentially, they are opposite sides of the same contract.

    See Accessibility in Metro style apps using C++, C#, or Visual Basic for an overview of the server side support (making your app accessible) and see UI Automation Overview for an overview of the whole UI Automation system.

    --Rob 

    Monday, August 13, 2012 8:32 PM
    Owner
  • Thanks Rob!

    1. Does this mean change in metro App which is to be tested ???

    2. I am not able to get Clickable point in my sample where as Inspect.exe is able to get clickable point without adding Server side code(XAML Accessibility).

    3. If we get Clickable point and issue mouse_event or sendInput function.Do you think this is feasible solution ?

     

    Monday, August 13, 2012 8:56 PM
  • 1. Yes. It is an accessibility bug for the app to support invoke behavior without supporting InvokePattern.

    2. If Inspect can get the ClickablePoint then your test app should be able to do so. Without knowing what your test app is doing it's hard to say what it is doing wrong. I suspect that you're getting the ClickablePoint from the wrong object.

    3. It's not a good solution as it doesn't fix the root problem with your app's accessibility.

    --Rob

    Monday, August 13, 2012 9:15 PM
    Owner
  • What I Understood from the link mentioned above is, we have to change Metro App which is to be Automation Tested.It means we have to add code to make certain things available to Automation client.But this approach is not always use ful. Why will the Metro App Developer will add the code to just make them available to Automation client.

    Here in my case Metro App is developed by some one else in the company where i work.it will be difficult to ask him to add code to add invoke pattern in the listitem as that piece of code is useless in terms of functionality of the app.

    Is there any other way to click it.Is Client-Side (Proxy) UI Automation Provider is the option for it.

    Please clarify it

    Thursday, August 16, 2012 8:34 AM
  • Yes, you need to change the app which is to be automation tested.

    The automation code is not useless in terms of functionality of the app: it is necessary for the app to be accessible.

    Depending on where you are and who your audience is, there may be legal requirements that your app be accessible. Regardless of whether it is required, it is a good idea.

    There are no other good solutions. You can come up with a hack, but I can't recommend one.

    --Rob



    Tuesday, August 28, 2012 2:59 AM
    Owner