question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Appium not finding WPF elements

See original GitHub issue

Copied 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: image.

However the actual application also has a TextBlock that should be above and below the ComboBox. image 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. image (sorry for the blurryness)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:24

github_iconTop GitHub Comments

1reaction
anunay1commented, Jul 31, 2020

I’m looking into if there’s some special way that we’re setting up the textblock that’s different from all the other ones I’m already able to access, but it needs to be a block rather than a box in the end. Do you have any thoughts/ideas why it might be doing this other than timing? Also, if you didn’t see I did send the video

Thanks, I saw the video and it appears pretty straight forward, why it searches with testbox and text block I don’t know.

1reaction
evansctcommented, Jul 31, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

wpf - Appium can't locate collapsed element
I'm trying to access the Type property of the custom prompt dialog from an automation test. So the element for the Type (text...
Read more >
Can't find an element by name in a wpf application - Support
I am running appium (with c#) and I have a window that have a combo box and the problem is like so: after...
Read more >
Get Your WPF Apps Automated With Appium
Automate your WPF app with Appium, Windows Application Driver and UI Recorder tool. ... and Appium will not be able to find the...
Read more >
UITesting automation for WPF DevExpress controls
Hi, I am trying to create a PoC project with sample UITests using Appium and DX controls. ... Unfortunately I cannot access any...
Read more >
Problem to find element with appium, application is running
Appium open application, but can't find any elements of the application. What I have wrong? I haved installed web driver client, I am...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found