microsoft / WinAppDriver

Windows Application Driver
MIT License
3.7k stars 1.41k forks source link

How to identify the objects in a frame? #1126

Open madgulakrishna opened 4 years ago

madgulakrishna commented 4 years ago

scenario is mentioned in the attached pic..

All frame as well as the object inside it has the same Automation id and there is no unique way to identify each of the objects.

I tried the code mentioned in the below mentioned query: https://github.com/microsoft/WinAppDriver/issues/669 Not much luck.

NOTE: I don’t want to use the co-ordinates to interact with the objects. This is a desktop based application.

WinAppdriver WinAppdriver2 Any suggestion in this regard is highly appreciated.

naeemakram commented 4 years ago

Have you tried to to use the method FindElementsByTag? By using this method call, you can retrieve all elements which have a specific tag name such as Button or Edit. There are other methods too which return a collection such as FindElementsById, it will return all elements which have similar ID. Once you have the collection, use a foreach loop to go through it and perform any operations. You may use Click, SendKeys, and GetAttribute on any WindowsElement object. Let me know if it helped or not.

NadeemBader commented 4 years ago

Hi

I'm facing the same issue. In my case, the frame contains many shapes that created based on a Collection of Items. That's mean, there is a Collection of Items (Called Buttons) defined in the frame and based on its items the frame is shaped. How can I access that collection of items using WinAppDriver?

Here is the collection:

    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    [Editor(typeof(System.ComponentModel.Design.CollectionEditor), typeof(UITypeEditor))]
    [RefreshProperties(RefreshProperties.Repaint)]
    public GenericEditableCollection<ButtonMatrixItem> Buttons
    {
        get
        {
            return buttons;
        }
    }

Hope you can assist

Best Regards, Nadeem Bader