New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
Highlighted
Absent Member.
Absent Member.
5477 views

How to Capture JavaList displayed value using QTP

Jump to solution
I Have few items displayed in the list in my application,List has 12 items of data. QTP has identified list has JavaList

Problem description :

I want to get all value's present(displayed) in the list,

I tried Getitem,GetROProperty,GetName,GetText,GetSelectedItem, but non of them are able to retrieve the value displayed in list.

Getitem,GetROProperty methods are displaying # with list of numbers which is same as item number .

Please let me know how to proceed
Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.
Try this:

set myObj = JavaWindow("ABC").JavaList("XYZ").object

iCount=myObj.getItemCount()
msgbox iCount

For i=1 to iCount-1
msgbox myObj.getItemAt(i).toString
Next

Regards,
Madhu

View solution in original post

0 Likes
9 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..
did you try

.GetROProperty("Value")?

you want to retrieve present selected value or all the 12-items from the list..?

bit confused on your query..

Can you paste that line of code here?

0 Likes
Highlighted
Absent Member.
Absent Member.
I have tried below methods

.JavaList().GetItem(2)
.JavaList().GetROProperty("value")
.JavaList().Object.getSelectedItem()
.JavaList().Object.getName()
--------------------------------------------

I want to retrieve all the values at once or one by one.

--------------------------------------------
Actual values which are displayed in list box is "Red","Green",Black" ...

But methods returns the value as #1,#2,#3 ....
0 Likes
Highlighted
Absent Member.
Absent Member.
Try .JavaList().GetItem("#2") and let us know if it's working.
0 Likes
Highlighted
Absent Member.
Absent Member.
Giving run time error
0 Likes
Highlighted
Absent Member.
Absent Member.
Try this:

set myObj = JavaWindow("ABC").JavaList("XYZ").object

iCount=myObj.getItemCount()
msgbox iCount

For i=1 to iCount-1
msgbox myObj.getItemAt(i).toString
Next

Regards,
Madhu

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.
Solution suggested by Madhusudhana is working.
0 Likes
Highlighted
Ensign
Ensign

I have tried this and it did not work, next is the structure of my application:

set myObj = JavaWindow("class_path:=thePath.*", "title:=.* theTitle").JavaInternalFrame("tagname:=theTagName").JavaList("tagname:=theTagNameOfTheList").object

iCount=myObj.getItemCount()
msgbox iCount

For i=1 to iCount-1
  msgbox myObj.getItemAt(i).toString
Next

 

I am getting:

Object doesn't support this property or method: 'myObj.getItemCount'

Line: iCount=myObj.getItemCount()

0 Likes
Highlighted
Lieutenant Commander
Lieutenant Commander

 

I tried below coding:

set myObj = JavaWindow("ReadyAPI 2.5.0 - SoapUI").JavaList("Number of run to save:").object

iCount=myObj.getItemCount()
msgbox iCount

For i=1 to iCount-1
msgbox myObj.getItemAt(i).toString
Next

Receved error - for method getItemCount 
This method or property doesn't support. 
 
0 Likes
Highlighted
Lieutenant Commander
Lieutenant Commander

suggestion please

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.