Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to parameterize
#1
Solved: 11 Years, 4 Months, 4 Weeks ago
In one of aplication, I have drop down box for each Date, Month and Year to select a Travel start date.
After selecting these fields when we go to the next page the selected date appear as mm/dd/yyyy format on next page as text element.
In QTP i want to verify if the date appearing on the next page is same as we select on first page.
Also if parameterize the dates of first page i want to validated the next page dates.
Can you please help me.
Reply
#2
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi sudhir,
In the page where the date appears in the format of "mm/dd/yyyy", get this value in a variable and use split function
eg:
Code:
vVar = Split("01/10/2009", "/")
now u will have vVar(0) = "01"
                     vVar(1) = "10"
                     vVar(2) = "2009"

Now, you will be able to check these three values with u'r previous page.
Reply
#3
Solved: 11 Years, 4 Months, 4 Weeks ago
Hello Manojith...

I hope your answer is not properly suitable for this question. if mm/dd/yyyy have drop down box how many combinations require to set the value.... Can u imagine?

Sudhir said that he have drop down box for each Date,month and year...

Here we have 3 drop down boxes for Date, Month and Year.
Date --> 1 to 31
Month --> 1 to 12
Year --> as per requiement

for parametrization we have to replace constants with parameters and pass values from external source like DataTable, Input/Output Parameters, Environment Variables, Random Numbers and Flat Files.

Once we set the value in to the application those are the expected values bcoz we got from our testcases or requirements.

Once we navigate to next page, here we can found that Objects of drop down boxes or any webobject in the form of Date... Here we have to capture the value if those values are individual, if the date is combined as webobject we have to split with the suitable delimeter and validate with the Expected Values available in our parameters and use reporter events to know how many iterations has been passed and how many failed.

For every Iteration we have to navigate from first page to next page and validate and return to previous page.

If you want me to give the code with any eg. I will provide you

thanks & regards
Baba Fakruddin.D
Reply
#4
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi Friends
the URL of my application is http://newtours.demoaut.com/mercurywelcome.php
Here You have to login with
username-tutorial
password-tutorial

Now, in on the first page select the Departure Month as january , Date as 28. Select Returning month as January , date as 30.
Now go to secod page. On this page for Depart section you see tha date as 1/28/2009.
I want to validate this date with first page selection.
for only single selection i am able to script.
but for multiple dates such as 24,25,26 how to parameterize it and validate the second page date for these multiple dates.

thanks
Reply
#5
Solved: 11 Years, 4 Months, 4 Weeks ago
Hello Friend,

This link is not working... please provide working link

thanks & regards
Baba Fakruddin.D
Reply
#6
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi just a slight modification
use http://newtours.demoaut.com/ this and same credientials as
username- tutorial
password- tutorial
Reply
#7
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi Fakruddin,
I am really sorry to say that in this scenario there is no concept of combinations

1. As In the first page where we select the Date and Month is to be passed from datatable or any other form of parameterization.
2. Imagine the date, month and year is passed from datatable and you have selected it in the application.
3. Now click on continue which takes to the second page where the date is displayed in the form of "mm/dd/yyyy".
4. As per my explaination...please take this data (second form) and split it i.e
vDate = Browser().page().Webelement().GetROProperty("innertext") 'this will give the date

Code:
vVal = Split(vDate, "/")
now you will have vVal(0) = "1"
                         vVal(1) = "29"
                         vVal(2) = "2009"

5. Compare these array values with the values you have in the datatable.

I hope i am answering to the question, please correct me if i am wrong.
Reply
#8
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi manojith,

Your perception on Manojith query is correct.

@sudhir : As manojith said in the above post , you can follow that process.
Reply
#9
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi Friends,
Above steps are correct only if single date is to be varified.
My query is how to check second page date (appearing in mm/dd/yyyy format and as text element ) which get change for
every new date selected on first page ( because i am paremeterizing first page dates.)
Reply
#10
Solved: 11 Years, 4 Months, 4 Weeks ago
Code:
'systemutil.Run "http://newtours.demoaut.com/"

datee=browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebElement("Jan 30, 2009").GetROProperty("innertext")
print datee
mon=split(datee," ")
Exp_mont=trim(mon(0))
print "month is :"&Exp_mont
Exp_day=trim(left(mon(1),2))
print "Date is :"&Exp_day
Exp_yr=trim(mon(2))
print "Year is :"&Exp_yr


browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "tutorial"
pwd=crypt.Encrypt("tutorial")
browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("password").SetSecure pwd
browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Sign-In").Click

fromday=browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromDay").GetROProperty("value")
print "Actual Date is :"&fromday
frommonth=browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromMonth").GetROProperty("value")
print "Actual Month is :"&frommonth

print "Date of 2nd page is     :"&fromday
print "Month of left 3 char's"&left(frommonth,3)

If (left(frommonth,3)=Exp_mont) Then
    reporter.ReportEvent micPass,"Month validation","Month is validated"
    else
    reporter.ReportEvent micFail,"Month validation","Month is mismatched"
End If

If (fromday=Exp_day) Then
    reporter.ReportEvent micPass,"Date Validation","Day is validated"
    else
    reporter.ReportEvent micFail,"Date Validation","Day is mismatched"
End If

'If browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WinButton("View Calendar").WaitProperty("enabled","True",40000) then

browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WinButton("View Calendar").Click


'Window("Select Departure Date").Activate
yr=window("Select Departure Date").WinObject("January 2009").GetROProperty("text")
act_yr=trim(right(act_yr,4))

If (act_yr=Exp_yr) Then
    reporter.ReportEvent micPass,"Year Validation","Year is Validated"
    else
    reporter.ReportEvent micFail,"Year Validation","Year is mismatched"
End If

window("Select Departure Date").Close
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  parameterize Excel Sheet Name in SQL bjitsidhu 0 2,941 07-20-2014, 08:34 AM
Last Post: bjitsidhu
  Parameterize at different pace, and multiple write to Excel joncfrazier 0 2,671 07-10-2012, 12:05 AM
Last Post: joncfrazier
  Parameterize Excel Columns for 2-Dimensional Array defcon3 2 3,624 06-20-2012, 04:59 PM
Last Post: defcon3
  Parameterize Melody M 11 7,480 11-21-2011, 01:28 AM
Last Post: naunihal
  How to parameterize the value which is in Object repository AdhikariS 4 7,448 09-06-2011, 12:38 PM
Last Post: AdhikariS

Forum Jump:


Users browsing this thread: 1 Guest(s)