Need to retrieve List attribute of Live Elements (JavaList)

Ask general questions here.
subrata1
Posts: 6
Joined: Sat Jun 02, 2018 3:12 am

Need to retrieve List attribute of Live Elements (JavaList)

Post by subrata1 » Mon Jun 04, 2018 8:43 pm

Thanks in advance... I have attached the screen shot for better understanding...
I am very new to this Ranorex and VB.Net world. I appreciate any feed back towards this
issue.

Problem Description -
I have javalist (total 29 items) to go thru and read its 'Live Element' attributes.
I can loop thru the entire list item (I got 29 of them). However, I am not quite sure how to get Live element of an attribute. I am using vb.net.

Private Sub Init()
' Your recording specific initialization code goes here.

Dim RanorexList As Ranorex.List
RanorexList = "/form[@title='GAR1']/container[@name='m_introPanel']//container[@name='cmConversionRatePanel']/container[@name='cmConversionRatesMaintenance']/?/?/list[@name='cmConversionRatesMaintenance']"
Dim count As Integer
Dim i As Integer
count = RanorexList.Items.Count
Delay.Milliseconds(10)
For i=0 To count-1
Dim myItem As String
myItem = RanorexList.Items(i).Text
MsgBox(myItem)
'myItem is returning ([email protected])
'However, I need to capture attribute value of 'Name' property.

Next


End Sub
Attachments
LiveElements.png
LiveElements.png (53.58 KiB) Viewed 127 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Need to retrieve List attribute of Live Elements (JavaList)

Post by Support Team » Mon Jun 04, 2018 9:13 pm

Hello subrata1,

I hope you found my email earlier today was able to help you get the values from the list of items you have. If not, please reply to the open support ticket and I will be happy to further assist you. In the meantime, I have copied my emailed response below to help any other users experiencing the same issues.
You can get the attribute value through a simple Get value action as depicted below.
1.png
1.png (34.11 KiB) Viewed 125 times
Since you are working in code, you can convert this to user code and implement this auto-generated code into your own code.
2.png
2.png (20.58 KiB) Viewed 125 times
This uses the following API call and should help you get the attribute value of an object.

https://www.ranorex.com/Documentation/R ... ueText.htm

Sample:

Code: Select all

Dim varName As String = buttonInfo.FindAdapter(Of Button)().Element.GetAttributeValueText("Name")
Cheers,
Ned
.
Image

subrata1
Posts: 6
Joined: Sat Jun 02, 2018 3:12 am

Re: Need to retrieve List attribute of Live Elements (JavaList)

Post by subrata1 » Mon Jun 04, 2018 10:17 pm

Thank you Ned...
It works when I have the following code.....

Dim ccyPairName As String = thisList.Items(i).Element.GetAttributeValueText("Name")