Page 1 of 1

retrieve runtime property

Posted: Fri Jul 23, 2010 9:58 am
by jainaakash
Hi Team,

I have a text field in the application which I identify by name at runtime. Now I want to read some other attribute's value (ChildIndex in this case). I tried few options but did not work, please help.

This is text object (txtOption)
Dim tabIntl As Ranorex.TabPage = repo.MUSHome.TabPageInternational
Dim txtOption As Ranorex.Text = tabIntl.FindSingle (Of Ranorex.Text) ("./text[@name='Australasia']")
----------------

Tried to get ChildIndex at runtime:
Dim elem As WebElement = New WebElement(txtOption)
Dim chIndx As String = elem.ChildIndex.ToString()
Error:
Ranorex.CapabilityNotSupportedException: The element does not support the required capability webelement'.

ThenI tried like:
Dim txtControl As Ranorex.Control = new Ranorex.Control(txtOption)
Dim chIndx = txtControl.GetPropertyValue("ChildIndex")
Error:
Ranorex.CapabilityNotSupportedException: The element does not support the required capability 'control'.

I also tried like below but no luck, seems to be not a valid stmt:
Dim chIndx = Attribute.GetCustomAttribute(txtOption, "ChildIndex")

Also, do we have to do it differently for different types of adapters..? or is there a generic way of getting runtime attribute values for any type of adapters? Please advice.


Thanks

Re: retrieve runtime property

Posted: Fri Jul 23, 2010 2:03 pm
by artur_gadomski
Did you try getting element of text adapter?
Ranorex.Text t = "path_to_element";
Element e = t.Element;
int childIndex = e.ChildIndex;

Re: retrieve runtime property

Posted: Mon Jul 26, 2010 8:32 am
by jainaakash
Thanks, that worked.