|
对象库object/login.vbs
Set Login_Browser = Description.Create()
Set Login_Page = description.create()
Set Login_WebEdit_UserName = Description.Create()
Login_WebEdit_UserName("name").Value = "_ctl0:content:username"
Login_WebEdit_UserName("type").Value = "text"
Set Login_WebEdit_Password = Description.Create()
Login_WebEdit_Password("name").Value = "_ctl0:content:password"
Set Login_WebButton_Login = Description.Create()
Login_WebButton_Login("name").Value = "Login"
Login_WebButton_Login("type").Value = "submit"
脚本 testscript/login.vbs
class Login
Function login(Sheet_Name)
msgbox("test")
'关闭所有的IE窗口,避免出现问题
SystemUtil.CloseProcessByName "iexplore.exe"
SystemUtil.Run "iexplore.exe",DataTable("URL",Sheet_Name),"","open","3"
'先加载对象库,在加载脚本文件
objectFilePath = pathFind(Environment("objectScriptFolderName"),"login","vbs")
ExecuteFile(objectFilePath) '加载对象库
curPage = Browser(Login_Browser).Page(Login_Page)
Login_Page.Sync
wait 10
curPage.Login_WebEdit_UserName.Set DataTable("用户名",Sheet_Name)
curPage.Login_WebEdit_Passwor.Set DataTable("密码",Sheet_Name)
curPage.Login_WebButton_Login.Click
wait 5
End Function
end class
运行到粗体这里就出问题了,如果把粗体部分去掉,在resource里加这个对象文件,也不行。
为啥啊? |
|