retrieve runtime property

Class library usage, coding and language questions.
jainaakash
Posts: 48
Joined: Thu Jun 10, 2010 11:06 am

retrieve runtime property

Post by jainaakash » Fri Jul 23, 2010 8:58 am

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

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 5:55 am
Location: Copenhagen, Denmark

Re: retrieve runtime property

Post by artur_gadomski » Fri Jul 23, 2010 1:03 pm

Did you try getting element of text adapter?
Ranorex.Text t = "path_to_element";
Element e = t.Element;
int childIndex = e.ChildIndex;

jainaakash
Posts: 48
Joined: Thu Jun 10, 2010 11:06 am

Re: retrieve runtime property

Post by jainaakash » Mon Jul 26, 2010 7:32 am

Thanks, that worked.