7

I am using Appium with WinAppDriver to control a WinForms / WPF application.

I am looking for a programmatic way to get the list of properties available on an element that has been retrieved.

My current thinking is to ask for the className and use this to look up a static dictionary of properties I have pre-configured.

var element = driver.FindElementByXPath(xPath);

var properties = element.getProperties();    // Is there something I can call here?

Jason
  • 840
  • 11
  • 23

2 Answers2

2

This is not the greatest solution but I figured I would mention it just in case someone else might find it useful:

It is possible to get the xml of the pagesource and look at the properties there. This can be accomplished by calling driver.PageSource which will return an xml string.

Hope someone finds this useful.

ThisWholeDev
  • 889
  • 8
  • 8
1

You can use element.GetAttribute("Value") to get the value. You can also use other attributes like LegacyState, Value.Value, IsEnabled, IsOffscreen, ControlType etc. You can catch hold of the list of attributes in Inspect.exe (UI access)that comes with windows tools

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Avinash
  • 188
  • 5
  • Definitely can manually add each property for each control type. I am looking for a more dynamic solution where I am creating user interface testing monkey which just presses buttons it finds. It would also map out the user interface as it goes. Basically looking to get the inspect.exe tree from appium. Is there a way of achieving this? – Jason May 08 '19 at 03:43