以后不在此处更新日志了,欢迎测友到新窝找我:http://www.wuchuanhu.cn/

当WatiN爱上QTP(二)

上一篇 / 下一篇  2009-07-08 15:05:29 / 个人分类:QTP&vbs研究

OK,今天再看第二个Demo.

Set IE = DotNetFactory.CreateInstance("WatiN.Core.IE","C:\Documents and Settings\Administrator\桌面\WatiN-2.0.10.928-net-2.0\WatiN-2.0.10.928-net-2.0\bin\WatiN.Core.dll")
Set Find=DotNetFactory.CreateInstance("WatiN.Core.Find","C:\Documents and Settings\Administrator\桌面\WatiN-2.0.10.928-net-2.0\WatiN-2.0.10.928-net-2.0\bin\WatiN.Core.dll")
IE.GoTo("http://www.51testing.com")
IE.WaitForComplete
IE.TextField(Find.ByName("searchkey")).TypeText("vbs测试webservice")
IE.Button(Find.ByName("subjectsearch")).Click()
Set   IEpage = IE.AttachToIE(Find.ByUrl("http://www.51testing.com/batch.search.php"))
Set LinkObj = IEpage. Link(Find.ByUrl("http://www.51testing.com/?uid-194902-action-viewspace-itemid-130043"))
IF LinkObj.Exists    Then
     LinkObj.Click()
   ' IE.AttachToIE(Find.ByUrl("http://www.51testing.com/?uid-194902-action-viewspace-itemid-130043"))
   Set  ConsoleObj= DotNetFactory.CreateInstance("System.Console","System")
   Consoleobj.Write("PASS")
     ' Msgbox("PASS")
else
          Msgbox("FAILL")
End If
IE.Close
IEpage.Close
IE.AttachToIE(Find.ByUrl("http://www.51testing.com/?uid-194902-action-viewspace-itemid-130043")).Close

这个demo里不光使用了WatiN的dll,也使用了.NET20的基本类库。大家可以比较一下这里的Consoleobj.Write与Msgbox。


TAG: QTP WatiN

kakamissyou的测试小栈 引用 删除 kakamissyou   /   2009-09-14 12:56:50
晕,console和msgbox一起用。
 

评分:0

我来说两句

Open Toolbar