![]() |
Easiest way to verify members of a List/Combobox - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Easiest way to verify members of a List/Combobox (/Thread-Easiest-way-to-verify-members-of-a-List-Combobox) |
Easiest way to verify members of a List/Combobox - Hbomb624 - 07-23-2008 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? RE: Easiest way to verify members of a List/Combobox - quickmy - 07-23-2008 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) Error for the Line# Code: FromCities(i) = browser("Deccan").Page("Deccan").WebList("ctlAvailCriteria_cboOrigin").GetItem(i) Can you pls let me know where i am doing wrong RE: Easiest way to verify members of a List/Combobox - Hbomb624 - 07-23-2008 I would try it this way: Code: Dim FromCities() You cannot dimension an array with a variable, you have to ReDim it. RE: Easiest way to verify members of a List/Combobox - quickmy - 07-23-2008 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... RE: Easiest way to verify members of a List/Combobox - Hbomb624 - 07-23-2008 you can try Code: set FromCities(i) = browser("Deccan").Page("Deccan").WebList("ctlAvailCriteria_cboOrigin").GetItem(i) check that GetItem is available for a Weblist... RE: Easiest way to verify members of a List/Combobox - quickmy - 07-23-2008 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() No idea why its giving the error. RE: Easiest way to verify members of a List/Combobox - Hbomb624 - 07-23-2008 Code: FromCities = browser("Deccan").Page("Deccan").WebList("ctlAvailCriteria_cboOrigin").GetROProperty("all items") This is how I am doing it now. I would like to NOT use a loop... RE: Easiest way to verify members of a List/Combobox - quickmy - 07-23-2008 Thank you, this worked out. But just let me know if you figure out what i was doing wrong in my logic. |