随笔分类 -  QTP相关

QTP连接MySQL (转载)
摘要:1.首先安装mysql数据驱动,qtp在windows系统下操作连接mysql,所以下载mysql-connector-odbc-5.1.8-win32.msi 下载地址:http://mysql.mirrors.pair.com/Downloads/Connector-ODBC/5.1/mysqlconnector-odbc-5.1.8-win32.msi51Testing软件测试网]2Uz7G#@"W El8q2.安装mysql驱动,默认安装即可。s$N8rPm+g03.添加默认数据源51Testing软件测试网n3e6SfckQ 控制面板->管理工具 阅读全文

posted @ 2012-09-05 11:06 张飞_ 阅读(582) 评论(0) 推荐(1)

QTP中的DOM操作
摘要:【注:在QTP层面操作对象时,对象必须是可见的,在DOM层面的时没有要求但有时在DOM层面对元素执行操作时无效又需要在QTP层面才能操作】通过vbs获取网页源码:Set XmlHttp1=CreateObject("MSxml2.XMLHTTP")XmlHttp1.Open "GET","http://www.baidu.com",falseXmlHttp1.Sendsource=XmlHttp1.ResponseTextmsgbox source通过QTP的document对象获取网页源码:For each tlink in Bro 阅读全文

posted @ 2012-08-17 12:24 张飞_ 阅读(2573) 评论(0) 推荐(0)

QTP的tsr对象库文件转换成XML
摘要:Function exportTsrToXml(tsrFilePath,xmlFilePath) Dim autoRepository Set autoRepository = CreateObject("Mercury.ObjectRepositoryUtil") '创建ORAOM对象 If Not fso.FileExists(tsrFilePath) Then '如果tsr文件不存在 MsgBox "Error:Missed the ObjectRepository file !",48,"Export tsr to xl 阅读全文

posted @ 2012-08-01 12:46 张飞_ 阅读(1097) 评论(1) 推荐(0)

QTP截IE滚动条全屏问题的完美解决办法
摘要:QTP截IE滚动条全屏问题,困扰了好久,一直没有好的解决办法。虽然网上流传有好多的工具,这些工具有这样那样的接口供QTP去调用,但是这些工具都有点老了,例如:snagit,ScreenCapture_Setup_v1.1.1对于IE8或IE8以上的版本就不支持了,或者WIN7/64位的系统也不支持了。我的试验环境:win7/64位 QTP11 IE8试验工具:ScreenCapture_Setup_v1.1.1试验代码:Function QTPIECapture(CaptureObj)Dir = "C:\ImageBMP.PNG"hwnd = CaptureObj.GetR 阅读全文

posted @ 2012-07-01 11:25 张飞_ 阅读(1592) 评论(2) 推荐(1)

截全屏工具介绍
摘要:http://snapsie.sourceforge.net/备忘 阅读全文

posted @ 2012-06-21 12:05 张飞_ 阅读(352) 评论(0) 推荐(0)

VBS生成随机数
摘要:Function GetRandomMath(m,n) Randomize GetRandomMath = Int(((n-m+1) * Rnd) + m)End Functionmsgbox GetRandomMath(20,30) 阅读全文

posted @ 2012-06-11 23:07 张飞_ 阅读(6745) 评论(0) 推荐(0)

VBS类似于ceil的函数
摘要:Function ceil(n,m) temp = n/m If Int(temp)/temp=1 Then ceil=temp Else ceil=Int(temp)+1 End IfEnd Functionmsgbox ceil(4,5)msgbox ceil(5,5)msgbox ceil(6,5)msgbox ceil(9,5) 阅读全文

posted @ 2012-06-05 13:11 张飞_ 阅读(463) 评论(0) 推荐(0)

vbs的sort(数组排序)
摘要:Function fSortArray(aSortThisArray)Dim oArrayList, iElementSet oArrayList = CreateObject( "System.Collections.ArrayList" )For iElement = 0 To UBound(aSortThisArray)oArrayList.Add aSortThisArray(iElement)NextoArrayList.Sortset fSortArray = oArrayListEnd Functionmyarray=Array(50,20,30)MsgBox 阅读全文

posted @ 2012-06-01 00:31 张飞_ 阅读(2952) 评论(0) 推荐(0)

QTP如何检查WEB对象是否隐藏
摘要:在WEB页面中隐藏对象的3种方式1、使用display例如:<label id="hiddenMessageDisplay" style="color:blue">This message is hidden using CSS display property</label><input onclick="if(this.value=='Show message'){this.value='Hide message';document.getElementById('hid 阅读全文

posted @ 2012-04-06 17:27 张飞_ 阅读(1358) 评论(1) 推荐(0)

VBS生成XML文件
摘要:Dim xmlDoc, rootEl, child1, child2, p'创建XML文档Set xmlDoc = CreateObject("MSXML2.DOMDocument")'创建根元素并将之加入文档Set rootE1=xmlDoc.createElement("BookStore")xmlDoc.appendChild rootE1'创建并加入子元素Set bookchild1=xmlDoc.createElement("book")Set ISDNAttribute=xmlDoc.createA 阅读全文

posted @ 2012-03-20 14:47 张飞_ 阅读(3677) 评论(0) 推荐(0)

QTP设置默认语句
摘要:目录\Mercury Interactive\QuickTest Professional\dat下面新增ActionTemplate.mst的文件,每次新建测试的时候,可以将以下信息自动加载到测试脚本里边 阅读全文

posted @ 2012-03-07 11:46 张飞_ 阅读(210) 评论(0) 推荐(0)

操作QC的附件
摘要:function uploadAttachmentToTestSet() set CurrentTSTest = QCUtil.CurrentTestSet Set AttachmentFactory = CurrentTSTest.Attachments Set Attachment = AttachmentFactory.AddItem(Null) '上传文件并更新 Attachment.FileName = "test.html" Attachment.Type = 1 Attachment.Post Attachment.Refresh set ... 阅读全文

posted @ 2011-11-29 13:16 张飞_ 阅读(293) 评论(0) 推荐(0)

QC中UploadResource的用法
摘要:API文档不详细,摸索半天,终于找到解决办法:Function uploadTestResultToQCSet objPath = CreateObject("Scripting.FileSystemObject")If Not objPath.FileExists("C:\test\test.xls") Thenmsgbox "not exist file"ExitTestEnd IfSet objPath = nothing Set ResourceFactory = QCConnection.QCResourceFactory& 阅读全文

posted @ 2011-08-11 18:44 张飞_ 阅读(447) 评论(0) 推荐(0)

test and action parameter
摘要:网上有些关于如何使用Action参数的文章,不过关于QTP的Test参数和Top-Level Action参数的使用例子几乎没有。 有些人甚至不知道这个参数做什么用的,尤其是Test的output不知道怎么取。 其实它是外部对象传给它的(这个外部对象可以是Quality Center,也可以是vbs这样的驱动程序)。 以下给大家讲解一个关于QuickTest的Flight的例子。 首先,在QTP里录制一段脚本,代码如下: CODE:SystemUtil.Run "C:\Program Files\Mercury\QuickTest Professional\samples\fligh 阅读全文

posted @ 2011-08-11 15:37 张飞_ 阅读(373) 评论(0) 推荐(0)

VBS获取命令行参数传值
摘要:什么意思呢?其实就是在cmd下,运行VBS文件时,如果后面跟随的有参数,比如这条命令:”test.vbs test1 test2″. 获取后面的test1和test2.类似于C#中的args。在VBScript中,是通过一个组件来实现这个功能的,组件的名字是“WScript.Arguments”,这个组件不需要Create,直接Set就行(也许这玩意不是组件吧),看代码吧:Set oArgs = WScript.Arguments For Each s In oArgs MsgBox(s) NextSet oArgs = Nothing 阅读全文

posted @ 2011-08-08 18:48 张飞_ 阅读(12433) 评论(0) 推荐(0)

QTP Set Ele_name=description.Create()
摘要:Dim Ele_nameSet Ele_name=description.Create()Ele_name("Class Name").value="JavaEdit"Dim objset obj = JavaWindow("title:=test1").JavaObject("name:=test2").ChildObjects(Ele_name)For i=0 to obj.count-1print obj(i).GetROProperty("developer name")Next 阅读全文

posted @ 2011-08-02 11:30 张飞_ 阅读(1038) 评论(0) 推荐(0)

QTP往下拉IE的滚动条
摘要:1. Dim pageobj '//定义画面对象Set pageobj = Browser("百度搜索_helloworld").Page("百度搜索_helloworld")'//画面对象赋值pageobj.RunScript("scroll(0,document.body.scrollHeight);")2.x = Browser("b").Page("p").WebElement("WebElement").GetROProperty("wid 阅读全文

posted @ 2011-07-12 14:38 张飞_ 阅读(1682) 评论(0) 推荐(0)

QTP之旅---前传
摘要:在北京漂流了五年,终于回到武汉这片熟悉的地方了,由于工作环境的变动,以及公司所提供的资源,以后可能要用到QTP了,接下来我会把我所学习以及用到的QTP的关键点给全部记录下来。敬请期待!记录一下时间:2011-06-27加油!fighting~~~~~~~ 阅读全文

posted @ 2011-06-27 16:02 张飞_ 阅读(332) 评论(0) 推荐(0)

导航