Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select Current Date from a Calendar Control
#1
Solved: 10 Years, 9 Months, 1 Week ago
Hi All,

I need to select the current date from a Calendar control on my web application. Please see the attachment to get an idea of what i want to perform.

Appreciate if someone can help me on this.

Thanks a lot.


Attached Files Image(s)
   
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
I think in this case, you might go with Descriptive programming instead of using OR.
Reply
#3
Solved: 10 Years, 9 Months, 1 Week ago
Thanks ssvali for your reply.

I found a way to handle it. Below is the code i use

1. I had to set the focus on the webedit so it will pop-up the calendar control

Code:
Browser("br_xyz").Page("pg_abc").WebEdit("we_EndTime").FireEvent("onclick")

2. Select the current date

Code:
Browser("br_xyz").Page("pg_abc").WebElement("innertext:=" &Day(Date),"html tag:=DIV").Click


Hope this will help others too Smile
Reply
#4
Solved: 10 Years, 9 Months, 1 Week ago
Its good that you find solution by ur own.

So u added the object to OR and then clicking it. What if in future if the requirement change.

say for ex:- Today's requirement is to click on current data but the if requirement change to click on some other date provided by user.

What i suggest you that write to function to click any given date in the calendar.
Reply
#5
Solved: 10 Years, 9 Months, 1 Week ago
Hi I think he handled the situation correctly, Please have a look another time he used inline description program to select the date

Code:
Browser("br_xyz").Page("pg_abc").WebElement("innertext:=" &Day(Date),"html tag:=DIV").Click

Here 'Day(Date)' will generate day from today's date in case if he needs to select a day from his own

Code:
iDay = 26

Browser("br_xyz").Page("pg_abc").WebElement("innertext:=" &iDay,"html tag:=DIV").Click
Hope this understand...
Reply
#6
Solved: 10 Years, 9 Months, 1 Week ago
Got it . Thanks for explanation.

I think i missed "&Day(Date)" while looking at earlier post.

But any have Thanks once again and sorry for inconvenience.

Regards,
Shashavali
Reply
#7
Solved: 10 Years, 9 Months, 1 Week ago
Thank you both for your replies.

Now im having this issue randomly. Calendar control will pop-up but sometimes it will not select the day although i have instructed QTP to click on the day. (pop-up will stay as it is without selecting the day and focus will go to next field)

I have no idea why this is happening.

Any ideas?
Reply
#8
Solved: 10 Years, 9 Months, 1 Week ago
you can try below scenarios

1.
Code:
Add webtable to OR
Browser("br_xyz").Page("pg_abc").WebTable("Webtable").WebElement("innertext:=" &Day(Date),"html tag:=DIV").Click

2. you can try highlight(This will help to pen down the issue)
Code:
Browser("br_xyz").Page("pg_abc").WebElement("innertext:=" &Day(Date),"html tag:=DIV").highlight
Browser("br_xyz").Page("pg_abc").WebElement("innertext:=" &Day(Date),"html tag:=DIV").Click
Reply
#9
Solved: 10 Years, 9 Months, 1 Week ago
Thanks for the reply. But unfortunately calendar control is not highlighting.

How can i add the webtable to the OR. It has two web tables. (see the screenshot)

I think application is behaving in a funny way. When i navigate to another page of the application it won't identify any objects in the page. This happens for that particular page only.

I am lost now.
Reply
#10
Solved: 10 Years, 9 Months, 1 Week ago
Follow the below steps

1) Identify the Calendar window(identifies as WebElement) - Use Developer tool bar to found out the properties but not qtp spy
2) Conditional statement to check if the Calendar exist
3) Click on the Weblement using class and innertext along with Index:=0 (as there are some situations where the calendar will display more than one 7 - eg: if you click on your system date today you will find two 7s')

Let me know if you need any help
Thanks,
SUpputuri
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP not recognizing date calendar kQTPs 1 3,460 12-20-2017, 11:21 PM
Last Post: harikrishna
  select a date from pop-up calendar Dertjon 1 5,598 05-13-2014, 02:29 PM
Last Post: Ankur
  How to capture the DATE from the Calendar control in a sharepoint application Simr 3 10,032 09-17-2012, 03:50 PM
Last Post: visitjaga
  .Sync is NOT waiting for browser to complete current navigation.. can anyone help? mansis 4 4,301 09-14-2012, 06:53 PM
Last Post: mansis
  Need Help Datatable Parameterzing Date debindas 1 3,442 08-30-2012, 11:43 PM
Last Post: QTPScript

Forum Jump:


Users browsing this thread: 1 Guest(s)