WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

Unable to locate Grids or Windows

Open phenry9999 opened this issue 1 year ago • 5 comments

I am trying to test drive a WPF application. I have the WinAppDriver loading properly, and the Driver as well opening up my application. However, when I try to FindElement for a Window or a Grid, I get an error. OpenQA.Selenium.WebDriverException: 'An element could not be located on the page using the given search parameters.'

My find is quite simple IMHO. var mainWindow = Driver.FindElementByAccessibilityId("MainWindowGrid");

Likewise the xaml is simple. <Grid AutomationProperties.AutomationId="MainWindowGrid"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> .....

It seems like the only thing I can find is a Button. What am I doing wrong that I cannot locate anything useful? Please help. Thank you.

phenry9999 avatar Mar 27 '24 17:03 phenry9999

What is shown in inspect.exe?

anunay1 avatar Mar 28 '24 11:03 anunay1

I'm sorry, what is the inspect.exe tool? Do you mean after using the UIRecorder? I have both the automationid and a name in there but my Driver.FindBy methods give me errors. Inspector

InspectorError

I get the same error with the AutomationId InspectorError2

phenry9999 avatar Mar 28 '24 14:03 phenry9999

No the one that comes with windows SDK. https://github.com/microsoft/WinAppDriver/blob/master/Docs%2FFAQ.md

anunay1 avatar Mar 28 '24 14:03 anunay1

I found a copy of it. Trying it now. It shows the automation id I'm expecting when I hover over the menu option I want. What am I missing? InspectorShowingAutomationId

phenry9999 avatar Mar 28 '24 15:03 phenry9999

I think I found something. If I try to find the nested button, it won't find it....until I click the parent's File menu option. Is that required? Why can't it find the nested file menu exit button?

phenry9999 avatar Mar 28 '24 15:03 phenry9999