Need to retrieve List attribute of Live Elements (JavaList)

Ask general questions here.
subrata1
Posts: 7
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 (com.ebsdr.bn.bp.subsystems.credit.untrusted.CurrencyRateC@cbdef5)
'However, I need to capture attribute value of 'Name' property.

Next


End Sub
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

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
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
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
You do not have the required permissions to view the files attached to this post.

subrata1
Posts: 7
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")