How to select item from weblist? - 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: How to select item from weblist? (/Thread-How-to-select-item-from-weblist) |
How to select item from weblist? - SS001 - 06-09-2010 Hi, I need to select a time from a calendar pop up, the time is displayed in a list. i have recorded the time by clicking the list but while running, the time is not selected from the list. code: Code: Browser("Calendar").Page("Calendar").WebList("Hour").Select "8" Can anyone help me Thanks in advance RE: How to select item from weblist? - vijayendra.shukla - 06-09-2010 Hi, You can refer the items using index property to fetch from a list. From what you have given, I understand that hours and minutes drop down are separte and will always present values from 0-12/24 and 0-60 respectively. E.g. Code: Browser("Calendar").Page("Calendar").WebList("Hour").Select "#3" Note - Indexing starts from 0 so the above line will fetch the 4th value from the drop down list. But if the values in the drop down change then irrespective of the value you want, it will always give you the value in the 4th position of the drop down. I hope this helps. RE: How to select item from weblist? - basanth27 - 06-09-2010 Intresting. It should select the value based on what you supply. The above statement looks absolutely fine to me. Does it throw any error message ? can you try , code: Code: Browser("Calendar").Page("Calendar").WebList("Hour").Highlight 1. Grab all the items in the list by using the value property. 2. Split the values if they are semicolon separated. 3. Compare the value which you need to select vs the value in the split array. 4. Select based on the index. this is a foolproof method because the index does not get hardcoded here. so, inspite of the shift in the value location it will still select the right one. |