askepott
askepott

Reputation: 279

How to identify a winforms button control that has no AutomationId?

I've been tasked to find out how to implement UI automation for desktop apps with appium-dotnet-driver. I've successfully managed to use the windows calculator app for UI unit testing.

That being said, having a lot of trouble with my company's winforms app because some elements either don't have an AutomationId or it changes every time something is clicked on the program.

Is there an easy way to define the AutomationId for a control type (i.e. Button)?

Upvotes: 2

Views: 1440

Answers (1)

askepott
askepott

Reputation: 279

Solved by setting the Name property of relevant controls. AutomationId is automatically inferred from Name or Text properties. Hope it helps someone.

Upvotes: 2

Related Questions