Winappdriver: OpenQA.Selenium.WebDriverException: 'An element command could not be completed because the element is not pointer- or keyboard interactable.'

Created on 5 Aug 2020  路  5Comments  路  Source: microsoft/WinAppDriver

We have a complex application that is being automated. In this given scenario, we have a WPF app with a listview and a couple of items in the list. First time into the page, the element with an automation id can be found.

Second time in results in the above error.

The element can be found, however Displayed = false. and the rect position is incorrect (wrong values and 0 for width and height).

Restarting WinAppDriver gives the same problem.
Inspect.exe shows the correct values.
Visual Studio Live Visual Tree shows the correct values (Automation Properties IsOffScreen = false, etc..)

PageSource snippets:

                    <ListItem AcceleratorKey="" AccessKey="" AutomationId="NewProductItem" FrameworkId="WPF" HasKeyboardFocus="False" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="False" LocalizedControlType="list item" Name="" Orientation="None" ProcessId="5636" RuntimeId="7.5636.43273738" x="62" y="92" width="243" height="98">


                    <ListItem AcceleratorKey="" AccessKey="" AutomationId="NewProductItem" FrameworkId="WPF" HasKeyboardFocus="False" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="True" LocalizedControlType="list item" Name="" Orientation="None" ProcessId="5636" RuntimeId="7.5636.43273738" x="-567" y="-295" width="0" height="0">

WPF app 4.6.1.
WinAppDriver 1.1.1809.18001
AppiumWebDriver 4.1.1

Cheers

John

All 5 comments

What is not being found, the list view or the list item?
Can you share some code?

It's the ListItem, but it only fails on the second time into the page. We have a complicated navigation model that dynamically adds views into content areas, the views get recreated when the screen is revisited, the viewmodel is cached.

I did knock together a stand alone sample trying to create a repo - but low and behold that works. I'm looking to spend some time to make the repo more representative to our application.

It seems as though some state isn't being updated, perhaps within the guts of WPF or the automation layers -- since as I mentioned previously I can see that the IsOffScreen property is true as far as WinAppDriver is concerned, but attaching a debugger and traversing the visual tree shows the IsOffScreen=false.

It's not complicated code in terms of automation -- as it finds the element correctly, just it can't interact with it.

Hi John,
I have noticed that objects of ListItem have a "displayed" set to false if they're not being displayed on the screen.
Maybe you could press the down arrow key in a for loop until the item you need is displayed or you've been through all list items.

It's the ListItem, but it only fails on the second time into the page. We have a complicated navigation model that dynamically adds views into content areas, the views get recreated when the screen is revisited, the viewmodel is cached.

I did knock together a stand alone sample trying to create a repo - but low and behold that works. I'm looking to spend some time to make the repo more representative to our application.

It seems as though some state isn't being updated, perhaps within the guts of WPF or the automation layers -- since as I mentioned previously I can see that the IsOffScreen property is true as far as WinAppDriver is concerned, but attaching a debugger and traversing the visual tree shows the IsOffScreen=false.

It's not complicated code in terms of automation -- as it finds the element correctly, just it can't interact with it.

If you can provide a sample app that would be great

I just had the same issue. I recently upgraded from Dev Express v20.1 to v20.2, and in the older version a DevExpress.XtraBars.Ribbon.RibbonStatusBar (and child elements) had attribute "isOffScreen=False", in the newer version the value was True. WinAppDriver cannot interact with the element in this state and throws the error mentioned in this issue header. I opened a bug ticket with Dev Express and meanwhile they reproduced the issue and confirmed the bug. Meanwhile use their project converter to change the references to an earlier version to avoid this error.

Was this page helpful?
0 / 5 - 0 ratings