问题
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!
回答1:
Just a quick workaround to enable the calendar textbox & to enter the value
Browser(..).Page(..).WebEdit(...).Object.disabled = False
Browser(..).Page(..).WebEdit(...).Set "12/12/2000"
回答2:
Well you can try descriptive programming.
Define obj that is of type link and then use ".childobjects" property to pick up the date from a webtable.
Note: Here I am considering the calender is a webtable, and dates in it are links.
Please also let me know if this worked for you, and if somebody has any other thoughts most welcome. Thanks!
来源:https://stackoverflow.com/questions/29209843/automating-date-control-using-qtp