Dynamic attributes

Best practices, code snippets for common functionality, examples, and guidelines.
Juan
Posts: 19
Joined: Wed Jul 20, 2016 1:18 pm

Dynamic attributes

Post by Juan » Tue Sep 06, 2016 3:07 pm

Hi all. Is there anyway to obtain attributes from Dynamic? I know I can find items by dynamic attributes, but in C#, once I have the control, I want my method to return the name value from dynamic, how can I access that attribute? I can for example return the class by control.As<WebElement>().class but with Dynamic is not working
Attachments
hazards.png
hazards.png (16.12 KiB) Viewed 971 times

Langrisser
Posts: 4
Joined: Tue Jun 21, 2016 1:53 pm
Location: Germany

Re: Dynamic attributes

Post by Langrisser » Thu Sep 08, 2016 9:45 am

hy Juan,

since, I am unable to post url, you can look for GetAttributeValueText Method (name) in Ranorex.Core.Element

You can get the value by passing your desired attribute, e.g. "name" to get the value "Hazards"

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Dynamic attributes

Post by asdf » Fri Sep 09, 2016 12:27 pm

Hi Juan,

In order to get the dynamic name, I would recommend using the GetValue-action in Ranorex Studio.
Therefore, just add a new GetValue-action, choose the attribute you want to get ('name' in your case) and drag & drop the regarded repository element in there.

If this explanation is not clear enough, please post a snapshot of your application under test, in order to further analyze this.

I hope I could help.

Kind regards,
asdf