How to target windows app controls/elements form Appium using some unique identifier

37 views Asked by At

I am building a WinForm app in .net 4. The app has a feature to upload a file. I want to write a test case for this feature.

For testing, I am using Appium alongside WinAppDriver for UI automation. So when I run the test, it should click the upload file button , which opens up a "file explorer" window, like shown bellow: enter image description here

Then the automation, should move to a desired folder, enter the name of the file in the file name text field that is at the bottom on the file explorer window above, and finally, it would click the open button (which is also on the bottom right corner of the window above) to open the file in my app.

I have implemented all other automation, but I am a bit lost on how to automate the "open" button click "properly". I am currently selecting the button using its text, which works fine:

windowsAppiumDriverSession.FindElementByClassName("Button").FindElementByName("Open").Click();

But the issue is that the application will be used in computers with different languages. So, based on the current systems language windows will update the name of the button (for example to Öffnen in German). So I want to target the button based on a property that is a constant identifier that does not change.

I tried using the inspect app to see if there is some sort of id that I can use, but I didn't find anything similar to that. ChatGPT suggested to me use the button's accessibility id, which also I do not see in the inspect app.

0

There are 0 answers