Please help me in automating date control object using QTP.
I’m trying to automate date control as it picks the user required date (** can be from previous year too) during run time. But I couldn’t achieve it by using the date control object, as that IMAGE object doesn’t have any in-built operations to select required.
Note: Textbox is disabled and so we cannot enter the date into it directly, so we should select the required date from the calendar object. Thanks!
27-Mar-2015: Updating with AUT screen for more clarity
Here is the date control I’m trying to automate, prior to this application, I just used to add the textbox control and SET the required date into it. But in this case, the textbox is not editable, and so we I have to pick the date from the date control object – most the dates (inputs) are from past years.
So I just tried to capture the control object and it’s got recognized as IMAGE, using which I couldn’t perform only the click action.
Please check and help. Thanks!
From UFT 12 version onwards, we can hit java script to identify an object. Please refer below code.
‘Click on Calendar text box/Datepicker
‘click on the <> arrow to move month
‘Get the month
objMonth = Browser().Page().WebElement().GetRoProperty(“Text”)
‘suppose that you want to select date as – 1st January
If objMonth == “January” Then
objDate = Browser().Page().WebElement().GetRoproperty(“Text”)
If objDate == “1” Then
- Bhavin Shah answered 3 months ago