Global unique identifier for WinForms/WPF controls?

166 Views Asked by At

For test automation purposes I would like to target specific UI controls in WinForms and WPF applications in a fast and resilient fashion. Currently I find myself using XPath to achieve this goal and it is brittle and slow. Ex:

  /form[@controlname='frmPayloadDims']/container[@controlname='pnlAdajacent']/container[@controlname='grpThruster']/checkbox[@controlname='chkMegaJoulInclinationDeg'] ...

I'm looking for a better solution, perhaps similar to the HTML DOM's id attribute. There, model elements are available directly through their unique ids without having to build long paths.

Is there a global, unique and stable (across app restarts) identifier that I can set on controls when coding them so that I can use it to directly address them from Ranorex or similar UI automation tools?

0

There are 0 best solutions below