Exposing custom attributes to UI elements

Is there a way to expose custom attributes for elements such that after finding them with appium, I can get the value of the attribute using the GetAttribute() function?

For example if I have a custom graph element that has an attribute called “data”, is there a way to expose this attribute so I can do something like this (using Xamarin Forms):

var graphElement = AndroidDriver.FindElementById(“mygraph”).GetAttribute(“data”);

if you able to see your “data” attribute it in:

  • driver.getPageSource()
  • ui element inspector

then given code will work.