Page 1 of 1

How to get FlavorElement.Name property?

Posted: Tue Sep 22, 2015 2:24 pm
by marasanov
Hi all,

I need to get FlavorElement,Name property (see snapshot below)
properties.PNG
I tried with

string name = item.FlavorElement.Name;

but I can't access it that way
no_property.png
Do you have any idea how to handle this?

Thanks.

Re: How to get FlavorElement.Name property?

Posted: Tue Sep 22, 2015 2:33 pm
by odklizec
Hi,

Have you tried this...

Code: Select all

string name = item.FlavorName

Re: How to get FlavorElement.Name property?

Posted: Tue Sep 22, 2015 3:11 pm
by marasanov
Yes, I get 'WPF' when I try that.

I've managed to get a workaround with

Code: Select all

string name = item.ToString();    // this returns {Text:Engineer}

// and then I do search/replace
name = name.Replace("{Text:",string.Empty);
name = name.Replace("}",string.Empty);
This gets me what I need but it's not very elegant solution :)

Re: How to get FlavorElement.Name property?

Posted: Thu Sep 24, 2015 2:00 pm
by Support Team
Hello marasanov,

I would suggest taking a look at the corresponding element with Ranorex Spy.
RanorexSpy_TextBlock.png
In my sample, the value for the 'Name'-attribute of the TextBlock-element is 'Engineer'.
You can read this value using the GetAttributeValueText()-method for the corresponding element.

Code: Select all

string name = repo.<Form>.<TextBlock>.Element.GetAttributeValueText("Name");
Please let me know if you need more information.

Regards,
Johannes

Re: How to get FlavorElement.Name property?

Posted: Thu Nov 02, 2017 2:59 pm
by Sundaytwins
HI,

I struggled just as you to get the 'Name' property from Flavorelement.

I got there using this:

Code: Select all

var CurText = ((Ranorex.Plugin.MsaaFlavorElement)cell.Element.FlavorElement).Name;
I think you could use a string also.

Hope this helps to get a more 'practical' solution to your problem.

Best regards,
Dominic