microsoft / WinAppDriver

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

WinAppDriver Only Finding Title Bar in Window #1546

Open tomjackman opened 3 years ago

tomjackman commented 3 years ago

Seeing a problem where WinAppDriver only sees the title bar on a private app. All elements (buttons, input boxes) are selectable using inspect.exe.

wdio conf file capabilities

"ms:experimental-webdriver": true,
"ms:waitForAppLaunch": 3

The window source logged

 <?xml version="1.0" encoding="utf-16"?><Window AcceleratorKey="" AutomationId="" ClassName="ThunderRT6FormDC" FrameworkId="Win32" HasKeyboardFocus="False" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="window" Name="REDACTED" Orientation="None" ProcessId="19400" RuntimeId="42.396646" x="0" y="0" width="419" height="401" CanMaximize="False" CanMinimize="False" IsModal="False" WindowVisualState="Normal" WindowInteractionState="ReadyForUserInteraction" IsTopmost="False" CanRotate="False" CanResize="False" CanMove="True" IsAvailable="True">

<TitleBar AcceleratorKey="" AutomationId="" ClassName="" FrameworkId="" HasKeyboardFocus="False" IsContentElement="False" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="title bar" Orientation="None" ProcessId="19400" RuntimeId="42.396646.3.-2147483647.396646.-2.0" x="1" y="8" width="417" height="23" />

// more elements should be here

</Window>

Any ideas?

anunay1 commented 3 years ago

Automation properties are not implemented for the controls. That is the reason you get automation ID as null.

tomjackman commented 3 years ago

Automation properties are not implemented for the controls. That is the reason you get automation ID as null.

They all have automation id's when using inspect.exe.

anunay1 commented 3 years ago

Can you share what is shown in inspect

tomjackman commented 3 years ago

@anunay1 Window is a bit cropped as it's a private app.

Screenshot 2021-06-24 at 05 02 59
kelly987654 commented 3 years ago

Did you figure out the issue on this?

StMargarit commented 1 year ago

I have the same problem, anyone figured this out? I also tried to use Appium Inspector and Title Bar is all it can see. But I can see the elements in Windows Inspect...

anunay1 commented 1 year ago

I have the same problem, anyone figured this out? I also tried to use Appium Inspector and Title Bar is all it can see. But I can see the elements in Windows Inspect...

What kind of application is it? Win32, wpf or UWP.

StMargarit commented 1 year ago

Hello, I figured it out. My app is WPF application. I use Appium server the same way as described here https://github.com/microsoft/WinAppDriver/issues/1692#issuecomment-1066565875, because I had the same problem as in the thread and I could not downgrade Selenium. I saw only title bar in Appium inspector, but what helped was running Appium inspector as administrator. Then I could see all the elements in my app. And similarly, running Appium server as admin, then my test works again (only Actions do not work, for example right click, but I think that is already known issue https://github.com/appium/appium/issues/16268).

anunay1 commented 1 year ago

Hello, I figured it out. My app is WPF application. I use Appium server the same way as described here https://github.com/microsoft/WinAppDriver/issues/1692#issuecomment-1066565875, because I had the same problem as in the thread and I could not downgrade Selenium. I saw only title bar in Appium inspector, but what helped was running Appium inspector as administrator. Then I could see all the elements in my app. And similarly, running Appium server as admin, then my test works again (only Actions do not work, for example right click, but I think that is already known issue https://github.com/appium/appium/issues/16268).

I would prefer to use inspect.exe.

StMargarit commented 1 year ago

Well it was weird but inspect.exe showed the elements somehow. But only when focus was on them. When I tried to click in the tree of elements, the element was there but its properties were unavailable (aside from title bar). So that was confusing.