microsoft / WinAppDriver

Windows Application Driver
MIT License
3.66k stars 1.4k forks source link

AutoScroll to Element not working during Click event #753

Closed vishwanathcp closed 5 years ago

vishwanathcp commented 5 years ago

The Application we are automating is Win32 legacy application.
In one of the screen, There is Table with Custom Controls in it. Number of Rows in Table (where each row element is Custom control), varies from 10 to 100 and when rows are greater Scroll bar will be enabled.

Problem Statement: As part of scenario we have to perform Click event on given Row and if the Row to be Clicked is not in visible state (i.e, required to scroll to be bring it to visible State), Such control are not able to Click, getting exception 'An Element command could not be completed because the element is not pointer or keyboard interactable' with WinAppdriver. AutoScroll to element is not working

When observed the properties of the Custom element 'IsScrollItemPatternAvailable' is set to false. Is this the reason autoscroll is not working?If yes, is there any workaround.

Note: Using CodedUI tool, for the same application if the Row is not visible state, script by itself performs autoscroll and performs the Click operation on same controls which is not happening with WinAPPdriver.

hassanuz commented 5 years ago

This looks to be a duplicate of 614.

Right now, I would recommend manually scrolling into view either via keyboard injection or the Actions Touch injeciton APIs.

vishwanathcp commented 5 years ago

Thanks, but with Same application other automation tool i.e., CodedUI works fine, it does the auto scroll.

Is there way to convert : Microsoft.VisualStudio.TestTools.UITesting.UITestControl to OpenQA.Selenium.Appium.Windows.WindowsElement

Reason we are asking is, we have existing suite of automation developed in coded ui and wanted to migrate to WinAppdriver.

In Case we get stuck as mentioned in above case, if there is option to convert Appium Windows element to UITestControl or Native object of UIAutomation Library, we can proceed further with custom code like below:

Where UIWindow.UICheckBoxListWindow.UIItemList is of type UITestControl

   var native = UIWindow.UICheckBoxListWindow.UIItemList.NativeElement as object[];
        if ((native != null) && (native[0] is IAccessible))
        {
            var dataList = native[0] as IAccessible;
            for (var index = 1; index < dataList.accChildCount; index++)
            {
                actions.Add(dataList.accName[index]);
            }

In other words getting access to Native Element from OpenQA.Selenium.Appium.Windows.WindowsElement