51Testing软件测试论坛

标题: 判断Flight订票是否成功,求助 [打印本页]

作者: lalaine520    时间: 2012-3-27 17:11
标题: 判断Flight订票是否成功,求助
本帖最后由 lalaine520 于 2012-3-27 17:12 编辑

通过订票系统,成功后Insert Order按钮会置灰,判断订票成功,否则不成功
代码如下:
  1. Dim Insert_Done_Exist

  2. Dialog("Login").WinEdit("Agent Name:").Set "mercury"
  3. Dialog("Login").WinEdit("Password:").SetSecure "4f717d499e1525f1fe87b11e1db904b91638b7e1"
  4. Dialog("Login").WinButton("OK").Click
  5. Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
  6. Window("Flight Reservation").WinComboBox("Fly From:").Select "Denver"
  7. Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
  8. Window("Flight Reservation").WinButton("FLIGHT").Click
  9. Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
  10. Window("Flight Reservation").WinEdit("Name:").Set "tom"
  11. Window("Flight Reservation").WinButton("Insert Order").Click
  12. Insert_Done_Exist=Window("Flight Reservation").WinObject("Insert Order").Exist
  13. If  Insert_Done_Exist=true Then
  14.   reporter.ReportEvent micPass,"order success","According to the fact,it has really successed"
  15. else
  16.   reporter.ReportEvent micFail,"order fail","According to the fact,it has really failure"
  17. End If

  18. Window("Flight Reservation").WinButton("Insert Order").Check CheckPoint("Insert Order")
复制代码
但是运行之中报错:
The "Insert Order" WinObject object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.
Line (13): "Insert_Done_Exist=Window("Flight Reservation").WinObject("Insert Order").Exist".

[attach]78192[/attach]

现求助大家,指点迷津,谢谢~
作者: mimmy    时间: 2012-3-27 18:40
很明显找不到对象啊
13行
Insert_Done_Exist=Window("Flight Reservation").WinObject("Insert Order").Exist
应该是
Insert_Done_Exist=Window("Flight Reservation").WinButton("Insert Order").Exist
作者: lalaine520    时间: 2012-3-28 15:06
很明显找不到对象啊
13行
Insert_Done_Exist=Window("Flight Reservation").WinObject("Insert Order"). ...
mimmy 发表于 2012-3-27 18:40


多谢多谢~~~一开始试WINBUTTON没有“.exist”属性,经指点成功了 ,谢谢!
作者: xiaobai1gpp2    时间: 2012-3-29 16:28
在对象库中把对象重新捕捉,添加以下,代码写的时候注意父级之间的关系
作者: lalaine520    时间: 2012-3-29 16:40
回复 4# xiaobai1gpp2


    谢谢~~~已经成功了~~
作者: luchao215225    时间: 2012-3-29 17:16
查询数据库
作者: lalaine520    时间: 2012-3-30 09:58
查询数据库
luchao215225 发表于 2012-3-29 17:16



    对了 这个FLIGHT的数据库怎么看呢




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