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 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
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