Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Easiest way to verify members of a List/Combobox
#1
Solved: 10 Years, 9 Months ago
In my application, I have a combobox with 8 items. I know what the 8 items should be. Currently I am using GetROProperty("all items") and then looping through the array to verify that the 8 listed match the 8 I know should be there. Is there a better way to do this?
Reply
#2
Solved: 10 Years, 9 Months ago
I was trying to implement what you said for the appln http://www.flyairdeccan.net/. Was trying to retrieve the values of "From" Select box
Cnt = browser("Deccan").Page("Deccan").WebList("ctlAvailCriteria_cboOrigin").GetROProperty("items count")
wait(3)
Dim FromCities(Cnt)
For i = 0 to Cnt -1
FromCities(i) = browser("Deccan").Page("Deccan").WebList("ctlAvailCriteria_cboOrigin").GetItem(i)
msgbox (FromCities(i))
Next

It gives me two errors
Error for the Line#
Code:
Dim FromCities(Cnt)
Expected integer Constant

Error for the Line#
Code:
FromCities(i) = browser("Deccan").Page("Deccan").WebList("ctlAvailCriteria_cboOrigin").GetItem(i)
The statement contains one or more invalid function arguments

Can you pls let me know where i am doing wrong
Reply
#3
Solved: 10 Years, 9 Months ago
I would try it this way:

Code:
Dim FromCities()
ReDim FromCities(Cnt-1)

For i = 0 to Cnt - 1
FromCities(i) = browser("Deccan").Page("Deccan").WebList("ctlAvailCriteria_cboOrigin").GetItem(i)
msgbox FromCities(i)
Next

You cannot dimension an array with a variable, you have to ReDim it.
Reply
#4
Solved: 10 Years, 9 Months ago
Thank you for the explanation.I got it now. But getting the same error for the line below

Code:
FromCities(i) = browser("Deccan").Page("Deccan").WebList("ctlAvailCriteria_cboOrigin").GetItem(i)

The statement contains one or more invalid function arguments

Any idea why this error is coming, i checked the syntax too...
Reply
#5
Solved: 10 Years, 9 Months ago
you can try
Code:
set FromCities(i) = browser("Deccan").Page("Deccan").WebList("ctlAvailCriteria_cboOrigin").GetItem(i)
or
check that GetItem is available for a Weblist...
Reply
#6
Solved: 10 Years, 9 Months ago
Its giving the same error when i use set
I even checked the GetItem method of weblist from the help, they gave an example too

Code:
Sub GetItem_Example()
'The following example uses the GetItem method to display the
'value of the first item in the list.
MsgBox Browser("Fill-Out Form").Page("Fill-Out Form").WebList("what-to-do").GetItem(1)
End Sub

No idea why its giving the error.
Reply
#7
Solved: 10 Years, 9 Months ago
Code:
FromCities = browser("Deccan").Page("Deccan").WebList("ctlAvailCriteria_cboOrigin").GetROProperty("all items")

NewArray = Split(FromCities,";")

For a = 0 to ubound(newArray)
     msgbox newArray(a)
Next

This is how I am doing it now. I would like to NOT use a loop...
Reply
#8
Solved: 10 Years, 9 Months ago
Thank you, this worked out.
But just let me know if you figure out what i was doing wrong in my logic.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Not able to get the list of items in Delphi Combobox Environment Object Raj Aryan Singh 3 1,951 02-04-2020, 12:32 AM
Last Post: Raj Aryan Singh
  [UFT] [WPF] Verify if the cell contains an image robertosalemi 0 1,778 10-25-2016, 06:57 PM
Last Post: robertosalemi
  Need to verify the drop down values based on condition santhoshmscsoftware 1 2,711 05-04-2016, 11:28 PM
Last Post: supputuri
  verify that parent properties match object currently displayed in your application. sona 0 2,943 02-21-2016, 12:00 PM
Last Post: sona
Exclamation How to verify whether pdf is completely loaded or not in webpage nmakkena 1 2,475 08-27-2014, 04:09 PM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)