Page 1 of 1

Can't get accesibleValue while iterating through list of treeitems.

Posted: Fri Feb 22, 2019 3:39 pm
by Zygmuntt
Hello, got a pretty big problem.
I've got an list with dynamicly generting objecets (treeitems).
I have to find all of them, and then get their value, which according to ranorex Spy is stored in AccessibleValue.
I'm able to get all of those items, but can't get AccessibleValue, for me it's always null.
Here's my code:
void ITestModule.Run()

Code: Select all

        {
           IList<TreeItem> h2List = Zliaczanie_pracownikowRepository.Instance.FrmMain.DataPanel.Self.Find<TreeItem>(".//TreeItem");
            foreach (Ranorex.TreeItem h2item in h2List) 
            {

            	h2item.MoveTo();
            var value =	h2item.GetAttributeValue<TreeItem>("AccessibleValue");  	 
        	}
        }
Move to was just to check, if its really this element, and it is. It can move to it without any problem, but cant get this Accessible Value.
Any ideas how to fix it?

Re: Can't get accesibleValue while iterating through list of treeitems.

Posted: Mon Feb 25, 2019 8:37 am
by odklizec
Hi,

Please upload a Ranorex snapshot (NOT screenshot) of the problematic element. Screenshot is not very helpful. Additionally, try to add 'Element' and use 'GetAttributeValueText' method in your code, like this:

Code: Select all

            var value =	h2item.Element.GetAttributeValueText<TreeItem>("AccessibleValue");

Re: Can't get accesibleValue while iterating through list of treeitems.

Posted: Thu Mar 07, 2019 3:09 pm
by manish
Hi,

The attribute value that you want to get is a string, I guess, so try changing

Code: Select all

var value =	h2item.GetAttributeValue<TreeItem>("AccessibleValue");
to

Code: Select all

var value =	h2item.GetAttributeValue<string>("AccessibleValue");
Hope it helps :)
Manish