Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Invalid call argument using DateAdd
#1
Solved: 11 Years, 3 Months ago
Hi,

I am a beginner in QTP and I have this error when I run my script. Please help.

Code:
departdate = DateAdd("m",1,"13-July-12")
Msgbox departdate

retdate = DateAdd("d", 5, departdate)
msgbox retdate

Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select departdate 'refer to DateAdd
    Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toDay").Select retdate

Thanks in advance.
Reply
#2
Solved: 11 Years, 3 Months ago
What error u r getting.

Regards,
Sankalp
Reply
#3
Solved: 11 Years, 3 Months ago
Hi Jow,
Please attach the snap shot of the screen you are working on.
According to me .....as you are using Weblist("toMonth") and as the name suggest it must take only the month value not the complete date.
Similarly, Weblist("toDay") will take only the day value and not the entire date.
For this.... store the day and month part in two different variables and then use them.

For eg
Code:
GetMonth = DatePart("m", departdate)

Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select GetMonth
Reply
#4
Solved: 11 Years, 3 Months ago
Hi K Gaurav Varshney,

Thank you for your help. I did the above suggestion and my script is now working Smile

Thanks againSmile
Jow
Reply
#5
Solved: 11 Years, 3 Months ago
Great Smile

Regards,
K Gaurav
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Click after CheckProperty to a WebElement passed via Function argument fails naruoga 0 1,142 02-28-2019, 11:46 AM
Last Post: naruoga
  Invalid file error importing xls file Makhado 0 1,359 10-04-2018, 04:33 PM
Last Post: Makhado
  The DataTable.ExportSheet operation failed. Invalid file. Niraj 2 6,260 05-05-2015, 11:40 PM
Last Post: babu123
  Invalid File error importing a spreadsheet but only on a VM msacks 1 2,716 10-19-2014, 09:04 PM
Last Post: supputuri
  How to pass all rows from data sheet in a function argument richa07 1 3,036 10-15-2012, 03:06 PM
Last Post: srinath_QTP

Forum Jump:


Users browsing this thread: 1 Guest(s)