Micro Focus QTP (UFT) Forums
Adding days when you have a calendar Icon - 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: Adding days when you have a calendar Icon (/Thread-Adding-days-when-you-have-a-calendar-Icon)



Adding days when you have a calendar Icon - Ann Hagglund - 04-18-2011

Hi, In my applicaiton the date is set my clicking a calendar image. I would like to add 7 days to todays date. As I can't type a date as I'm forced to click on the image I don't know how to do.

I have attached images of the calendar in my application.

Please help! Smile

Ann Hagglund, Adecco, Sweden


RE: Adding days when you have a calendar Icon - manishbhalshankar - 04-18-2011

Hi Ann,

Is the Go To field non-editable. Also please let me know the object properties of the objects in calendar (Month, Year, Date objects).


RE: Adding days when you have a calendar Icon - Ann Hagglund - 04-19-2011

Hi, Thank you for your answer. Yes it is Go To field non-editable I think. I attach an image showing the object spy and also the recording when I'm manually setting the dates. Once again, I really appreciate your help!
Please tell me if you need more information.

Best regards,
Ann Hagglund


RE: Adding days when you have a calendar Icon - manishbhalshankar - 04-19-2011

Hi Ann,

Try setting the date directly in the webedit. In Recording mode, click the webedit and type the required date in the preferred format. Check if it gets recorded.
Please let me know in case it is not working.


RE: Adding days when you have a calendar Icon - Ann Hagglund - 04-20-2011

Hi again,
I have tried that but you can't write anything in the Wededit. You must to use the Calendar. I can set it directly in other places in my application.

Thank you for your help!
Ann


RE: Adding days when you have a calendar Icon - Ann Hagglund - 04-28-2011

Hi again! I have tried and read as much as I can about this but I didn't manage to solve it. What I have seen, every figure in the calendar is a link.

Below you see my recording when I selected 29th of April.
Todays date (today 28th of April) is always default.

Code:
Browser("Njord Web Portal - Update").Page("Njord Web Portal - Update").Image("...").Click
Browser("Njord Web Portal - Update").Page("Njord Web Portal - Update").WebElement("PrevNextJanFebMarAprMayJunJulA_2").FireEvent "onmouseover"
Browser("Njord Web Portal - Update").Page("Njord Web Portal - Update").WebElement("Fr").FireEvent "onmouseover"
Browser("Njord Web Portal - Update").Page("Njord Web Portal - Update").Link("8").FireEvent "onmouseover"
Browser("Njord Web Portal - Update").Page("Njord Web Portal - Update").WebElement("1_9").FireEvent "onmouseover"
Browser("Njord Web Portal - Update").Page("Njord Web Portal - Update").Link("29").FireEvent "onmouseover"
Browser("Njord Web Portal - Update").Page("Njord Web Portal - Update").Link("29").Click

I know that I have asked a couple of times but I can't solve it by myself.

Greatful for help!Smile

Thank you in advance
Ann Hagglund, Adecco Sweden


RE: Adding days when you have a calendar Icon - vIns - 04-29-2011

Hi ... even if the textbox readonly, we can access the object properties and modify.
Code:
Browser("Log In").Page("Log In").WebEdit("name:=lname").Object.readonly = false  ' make it editable
Browser("Log In").Page("Log In").WebEdit("name:=lname").set "LastName"  ' set the value
Browser("Log In").Page("Log In").WebEdit("name:=lname").Object.readonly = true   ' make it readonly again



RE: Adding days when you have a calendar Icon - raja219 - 05-02-2011

Please try to find out the object properties of the calender and then use 'DateAdd' function to add dates.

Ex:-
Code:
Object = browser("Properties").Page("Properties").Image("Calender Properties")
variable = object.Dateadd("Interval",Number, Date)
msgbox variable

Here Interval represents: "d" or "m" or "Y"
Number represents: how many days or months or years you want to enter
Date represents the date which you have.


RE: Adding days when you have a calendar Icon - Ann Hagglund - 05-02-2011

Sorry to bother you again!
I don't get it to work.

If I add a date manually, e.g. 12th of May the code looks like:

Code:
Browser("Njord Web Portal - Update").Page("Njord Web Portal - Update").Image("...").Click
Browser("Njord Web Portal - Update").Page("Njord Web Portal - Update").Link("12").Click
I have written the following code due to your answer: (I might have done it in a wrong way)

"mydate=day(now)

Code:
Browser("Njord Web Portal - Update").Page("Njord Web Portal - Update").Image("AccessKey")
(Access key i found out with the Object Spy function)

Variable = Dateadd "d", 1, mydate
msgbox.variable

I have also tried to set in today's date (02/05/2011) but it is the same result:
I receive the following error message, see below.