51Testing软件测试论坛

标题: vbs 模拟鼠标单击,为什么循环一次后,无法单击了 [打印本页]

作者: yyc2164708    时间: 2010-6-22 17:14
标题: vbs 模拟鼠标单击,为什么循环一次后,无法单击了
SystemUtil.CloseProcessByName"iexplore.exe"
   SystemUtil.Run"iexplore.exe","","","",3
   Set BrowsDesc=Description.Create()
   Set PageDesc=Description.Create()
   Set CurPage=Browser(BrowsDesc).Page(PageDesc)
   Browser(BrowsDesc).Navigate "http://www.kodyy.com/index.php?r=home/album/index"
   CurPage.WebEdit("name:=username").Set "youhua"
   CurPage.WebEdit("name:=password").Set "youhua"
   CurPage.WebButton("name:=登 录").Click
   Set UpButton=Description.Create()
   Set UpButton=CurPage.Link("name:=上传")
   UpButton.Click
   Set AddButton=Description.Create()
   Set AddButton=CurPage.WebElement("html id:=uploadSwf")
   x=AddButton.GetROProperty("abs_x")+10
   y=AddButton.GetROProperty("abs_y")+10
   Set AddObj = CreateObject("AutoItX.Control")
   AddObj.LeftClick  x,y

   wait(2)
   Set WshShell=CreateObject("WScript.Shell")
   WshShell.SendKeys "C:\1.jpg"
   WshShell.SendKeys "%O"
   wait(2)
  Set AddObj=nothing
  Set UpLoadButton=Description.Create()
  Set UpLoadButton=CurPage.WebButton("html tag:=INPUT")
  UpLoadButton.Click
  wait(2)
  Set MyPicture=Description.Create()
  Set MyPicture=CurPage.Link("name:=我的相册","height:=30")
  MyPicture.Click
Set logout=Description.Create()
Set logout=CurPage.Link("name:=退出")
logout.Click
Browser(BrowsDesc).Close

[ 本帖最后由 yyc2164708 于 2010-6-22 17:39 编辑 ]
作者: TIB    时间: 2010-6-22 21:54
换AutoItX3.Control试试

   Set AddObj = CreateObject("AutoItX3.Control")
   AddObj.MouseClick x,y

或者换用DeviceReplay




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2