Appium not finding WPF elements
See original GitHub issueCopied over from Appium Github Issues as I was recommended that it was more of a WAD issue than one with Appium.
The problem
I am working on a team that is creating a WPF application, and I am tasked with doing automated testing on it. For the most part I haven’t have any issues at all and work has gone smoothly. However, there are a few elements that appium isn’t able to see. Most of them are TextBlock elements, where I am trying to grab the text so that I can confirm that the correct element is selected. When I look inside the visual tree on Appium Desktop, I see this: .
However the actual application also has a TextBlock that should be above and below the ComboBox.
Even though I have the TextBlocks ID’d in my code, it gives me an exception that says: OpenQA.Selenium.WebDriverException: An element could not be located on the page using the given search parameters.
The elements just seem to be completely invisible to Appium.
Environment
- Appium version (or git revision) that exhibits the issue: 1.17.1
- Desktop OS/version used to run Appium: Windows 10
- Type of application under test: WPF
Code To Reproduce Issue
var partNumDropdownTxt = partNumTile.FindElementByAccessibilityId("PartNumberDesc").Text;
This is what I’m using to find the element, which exists, but is not seen by appium, leading to the exception given above.
Edit: I’m posting a screenshot of inspece.exe to show that it is there and visible, but for whatever reason is not being found. Inspect is also noticing the AutomationID that the element has. (sorry for the blurryness)
Issue Analytics
- State:
- Created 3 years ago
- Comments:24
Top GitHub Comments
Thanks, I saw the video and it appears pretty straight forward, why it searches with testbox and text block I don’t know.
I tried changing it to a textbox rather than a textblock just to see what happened, and it had no issues at all finding/using it.