我们如何通过点击它来编写日历功能的描述性编程将形成填充
答案 0 :(得分:-1)
您好我在这里提到了我的代码,它采用dd / mm / yyyy格式的inpud日期,字段名称是div的html id的部分字符串,其中放置了日期选择器图标。这是因为在我的应用程序中,这是唯一正在改变的部分。
希望它能提供帮助。
Function selectDateFromDatePicker(strInputDate,strFieldName)
If Ucase(strInputDate) <> "BLANK" Then
arrayDate = split(strInputDate,"/")
' print "Month : " & arrayDate(0) & " Day : " & arrayDate(1) & " Year : " & arrayDate(2)
Set oPage= Browser("name:=CitiDirect BE \(SM\)").Page("title:=CitiDirect BE \(SM\)")
'oPage.WebElement("html id:=manageFilter:dateCreatedFrmPopup").HighLight
set objCalSpan = oPage_RVAM.WebElement("html id:=" & strFieldName & "Popup")
objCalSpan.Image("html id:=" & strFieldName & "PopupButton").Click
set objCalTable = oPage.WebTable("html id:=" & strFieldName & "")
arrayVar = Split(FormatDateTime(now(),1)," ")
objCalTable.WebElement("class:=rich-calendar-tool-btn","innertext:=" & arrayVar(1)& ", " & arrayVar(3)).Click
' oPage.WebTable("html id:=" & strFieldName & "DateEditorLayout").HighLight
Set dateEditorLayout = oPage.WebTable("html id:=" & strFieldName & "DateEditorLayout")
'select month
strMonth = MonthName(arrayDate(0))
' print "strMonth" & strMonth
dateEditorLayout.WebElement("class:=rich-calendar-editor-btn","innertext:=" & Mid(strMonth,1,3)).Click
flgYrFound = False
Do
strStartYear = oPage.WebElement("html id:=" & strFieldName & "DateEditorLayoutY0").GetROProperty("innertext")
strEndYear = oPage.WebElement("html id:=" & strFieldName & "DateEditorLayoutY9").GetROProperty("innertext")
If arrayDate(2) < strStartYear Then
dateEditorLayout.WebElement("class:=rich-calendar-editor-btn","innertext:=<").Click
ElseIf arrayDate(2) > strEndYear Then
dateEditorLayout.WebElement("class:=rich-calendar-editor-btn","innertext:=>").Click
Else
flgYrFound = True
End If
Loop While(flgYrFound = False)
If flgYrFound Then
'select year
dateEditorLayout.WebElement("class:=rich-calendar-editor-btn.*","innertext:=" & arrayDate(2)).Click
End If
'click OK
dateEditorLayout.WebElement("html id:=" & strFieldName & "DateEditorButtonOk").Click
'select day
objCalTable.WebElement("html id:=" & strFieldName & "DayCell.*","innertext:=" & Cstr(Cint(arrayDate(1))),"class:=.*DayCell rich-calendar-cell rich-calendar-btn").Click
End If
End Function