Browser("Login").Page("Page").Frame("contents").ViewLink("treeview").Image("Tplus").Click Browser("Login").Page("Page").Frame("contents").ViewLink("treeview").Image("Tplus_2").Click Browser("Login").Page("Page").Frame("contents").ViewLink("treeview").Link("开课设置").Click Browser("Login").Page("Page").Frame("main").WebList("drpStatus").Select "任意" Browser("Login").Page("Page").Frame("main").WebButton("查找").Click Browser("Login").Page("Page").Sync
Dim finded,findCode,Nowout 'define a constrat for find findCode = 110901 finded = false
Function MaxPage(pageString) 'msgbox pageString Dim ilen,i,j ilen = len(pageString) i=ilen While i>0 j = mid(pageString,i,1) 'msgbox j If instr("123456789",j)>0 Then MaxPage = j 'msgbox MaxPage Exit function End If i=i-1 Wend End Function
Dim trowcount,maxp trowcount = Browser("Login").Page("Page").Frame("main_8").WebTable("开课代码").RowCount msgbox "Rowcount: "&trowcount Nowout = Browser("Login").Page("Page").Frame("main_8").WebTable("开课代码").GetCellData(trowcount,1) Nowout = trim(Nowout) maxp = MaxPage(Nowout) msgbox "max page: "& maxp
Dim nowPage,checkid For nowPage = 1 to maxp If finded Then Exit for End If ' link to the 当前所需page If nowpage>1 Then Browser("Login").Page("Page").Frame("main_8").Link("[2]").SetTOProperty "Text","["&nowpage&"]" Browser("Login").Page("Page").Frame("main_8").Link("[2]").Click Browser("Login").Page("Page").Sync end if
' Get the rowcount of table in now page trowcount = Browser("Login").Page("Page").Frame("main_8").WebTable("开课代码").RowCount msgbox "Rowcount: "&trowcount
'link every record in the table of the page for i = 2 to trowcount - 2 Nowout = Browser("Login").Page("Page").Frame("main_8").WebTable("开课代码").GetCellData(i,2) 'msgbox i&": "&Nowout
checkid = "dgCourse:_ctl" &(i+1)& ":_ctl0" Browser("Login").Page("Page").Frame("main_8").WebCheckBox("dgCourse:_ctl3:_ctl0").SetTOProperty "name",checkid Browser("Login").Page("Page").Frame("main_8").WebCheckBox("dgCourse:_ctl3:_ctl0").Set "ON"
Browser("Login").Page("Page").Frame("main_8").Link("0901").SetTOProperty "Text",Nowout Browser("Login").Page("Page").Frame("main_8").Link("0901").Click Browser("开课设置详细信息").Page("开课设置详细信息").Sync 'wait(1) msgbox "begun" msgbox findCode msgbox Nowout msgbox "finished" If trim(findCode) = trim(Nowout) Then finded = true msgbox "find is ok!" wait(2) Exit for End If Browser("开课设置详细信息").Close Browser("Login").Page("Page").Sync next
Next |