These is no inbuilt method to get the JavaList Items or Values.
Use the below logic to get the JavaList items
Logic:
Set objStatus = JavaWindow("MainWindow").JavaInternalFrame("InternalFrame1").JavaList("Status:").Object
'Getting the count of no.of Items/Values in JavaList
intCount = objStatus.getItemCount()
'Displaying the Count of JavaList Items
msgbox intCount
'Reading one by one Values of JavaList
For i = 0 To intCount-1 Step 1
msgbox objStatus.getItemAt(i).toString
Next
Observation: I am using UFT11.5, & The above code run fine. But when i reopened my library file having above code and when i put my mouse cursor in above part of the code, UFT is crashing. So, If you also face the same issue try the below code.
Set objStatus = JavaWindow("MainWindow").JavaInternalFrame("InternalFrame1").JavaList("Status:")
'Getting the count of no.of Items/Values in JavaList
intCount = objStatus.Object.getItemCount()
'Displaying the Count of JavaList Items
msgbox intCount
'Reading one by one Values of JavaList
For i = 0 To intCount-1 Step 1
msgbox objStatus.Object.getItemAt(i).toString
Next
Use the below logic to get the JavaList items
Logic:
Set objStatus = JavaWindow("MainWindow").JavaInternalFrame("InternalFrame1").JavaList("Status:").Object
'Getting the count of no.of Items/Values in JavaList
intCount = objStatus.getItemCount()
'Displaying the Count of JavaList Items
msgbox intCount
'Reading one by one Values of JavaList
For i = 0 To intCount-1 Step 1
msgbox objStatus.getItemAt(i).toString
Next
Observation: I am using UFT11.5, & The above code run fine. But when i reopened my library file having above code and when i put my mouse cursor in above part of the code, UFT is crashing. So, If you also face the same issue try the below code.
Set objStatus = JavaWindow("MainWindow").JavaInternalFrame("InternalFrame1").JavaList("Status:")
'Getting the count of no.of Items/Values in JavaList
intCount = objStatus.Object.getItemCount()
'Displaying the Count of JavaList Items
msgbox intCount
'Reading one by one Values of JavaList
For i = 0 To intCount-1 Step 1
msgbox objStatus.Object.getItemAt(i).toString
Next
No comments:
Post a Comment