|
lz的是什么语言的控件,是不是DateTimePicker的?
如题。
好想QTP,在加载.net的add-in后,会吧类似DateTimePicker之类的线性控件都认为是swfObject,那控件行为就无法操作了。
如果是的话,你可以试试我的代码:
// Code Dummy //
function MIGetDate(pickerObject)
dim dt_date
dim swftypename, textObj
swftypename = pickerObject.GetROProperty("swftypename")
textObj = pickerObject.GetROProperty("text")
set obj = pickerObject.Object
if StrComp(swftypename, "System.Windows.Forms.DateTimePicker") = 0 then
dt_date = obj.value
dt_array = split(dt_date," ")
if InStr(textObj,"/") <> 0 then
GetDate = dt_array(0)
else
Reporter.ReportEvent micFail, "DateTimePicker", "Object does not support GetDate"
end if
else
Reporter.ReportEvent micFail, "DateTimePicker", "Object does not support GetDate"
end if
end function
// End Code Dummy //
如果不是的话,你可以试试我的思路,把System.Windows.Forms.DateTimePicker里面的DateTimePicker换成你的日期控件。碰碰运气。
希望有帮助。 |
|