How can I convert a UIElement to a string to see the entire content and all the attributes of the UIElement?
@JJOhYeah
uielementvar.tostring will only dump out the datatype
uielementvar.attributes will return a string array with all attribute keys
using this in a for each activity allows us to retrieve all available info on this element by:
uilelementvar.Get(“attributekeyname”)
Hi @JJOhYeah,
You can print or use the selector of the UiElement by UiElementvariable.Selector.tostring
If you want it’s contents, pass the selector to another activities like get text
You can also get it’s attributes by using get attribute activity also.
Thanks
The variable that I want to convert to string is a IEnumberable UIElement, and .attributes is not available for this datatype.
Thank you, but is there a way to see the entire contents of the UIElement?
cant you just use the debugger to see the contents? if it is a list just use like MyElements(0)
If it is a IEnumberable UIElement then is similar to a collection of uielements.
Attributes is available for an uielement
a single uielement you can retrieve with eg. first() or elementAt(IndexNo)
From where did you retrieved the enumerable? Does it come from a find children?
Thank you for your responses. Yes, the IEnumerable UIElement comes from a find children activity.
Ok. Yes, I see .attributes for an individual UIElement after using a loop for the IENumerable UIElement. Thank you!
@JJOhYeah
so picking up a particular uielement as mentioned above will allow you to access the attributes property. Does this work now?
UIElement.Attributes gives me an error as it is a one dimensional array. UIElement.Attributes(0) only prints out the attribute, and not the contents of the attribute. I suppose I could use a get attribute activity and print it out that way, but my goal is to see the all the attributes and values in one step.
@JJOhYeah
as mentioned above
attributes is giving you an array with all available attribute names
uielement.Get(YourAttributeName).toString let you access the attribute value
uielement.Get(uilement.Attributes(0)).toString would give you the value of the first attribute
with these building blocks you can go within a for each and can collect all attribute values
EDIT:
following component will support on this:
Yes that works. Thank you.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.