Micro Focus QTP (UFT) Forums
Month name select from WebList Box - 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: Month name select from WebList Box (/Thread-Month-name-select-from-WebList-Box)



Month name select from WebList Box - kamalakannan_anandan - 05-27-2011

Hi,

I am new to QTP. I have small doubt, how to select the month name, automatically using for loop.

Ex:
Code:
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select "January"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select "February"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select "March"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select "April"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select "May"

the above example, user manually selecting the month name. inserted of using for loop, it's select all month name in one line

Ex:
Code:
For nRow = 1 To 12
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select "January"
nRow = nRow + 1
Next

when loop is running, it's should select month name from WebList box "January", "February", "March", "May",....

I don't know how to write a script for this condition, Please help me to solve this problem.

Thanks & Regards,
Kamalakannan Anandan


Hi,

Code:
For nFromMonth = 0 To 11
    Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromMonth").ExtendSelect(nFromMonth)
    Wait 1 'Delay Time
Next


Thanks & Regards,
Kamalakannan Anandan


RE: Month name select from WebList Box - vIns - 05-27-2011

Hi,
There is a function - MonthName which returns name of the month.
MonthName(6) returns June.


RE: Month name select from WebList Box - rajpes - 07-06-2011

@ kamalakannan_anandan
that ExtendSelect will select all months one by one and i don't think anyone would be liking to seltct all months at a time

so just use "select"

Code:
For i= 0 To 11
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select i
Wait 1 'Delay Time
Next