文章分类 - QTP技巧-Web相关
摘要:Demo: Attribute Value Description left Alignment of the element 'Get the QTP WebTable from a specified objectPublicFunctionGetWebTableFromElement(ByValpObject)DimoTable, oParent'Get the parent table, a DOM object'Remember ...
阅读全文
摘要:Method1'Get the tables DOM objectSetoDOMTable=Browser("").Page("").WebTable("").object'To Click on (1,1) we can use:Row=1Col=1oDOMTable.rows(Row-1).Cells(Col-1).ClickMethod2We can also bindtothe corresponding WebElement object of the target cellandthenclick it.&
阅读全文
摘要:Function GetRowWithText(Obj, ByVal Text, StartFromRow, RegExpression)bReg = LCase(RegExpression)Set oDOM = Obj.ObjectIf bReg Then Set oReg = new RegExp oReg.Pattern = Text oReg.Global = True oReg.IgnoreCase = True Else Text = UCase(Trim(Text)) End if Dim iColStart, iRowStart If IsNull(St...
阅读全文
摘要:' ***************************** Function Library ****************************** RegisterUserFunc "WebTable", "ObjectsByMicClass", "ObjectsByMicClass"' Function: ObjectsByMicClass ' Description: Returns a collection of objects. All the objects in a ' WebT
阅读全文
摘要:'1.WebEdit:'HTML源代码样例:'<INPUT type="text" value="QuickTest" id="ID_001" name="NAME_001">'QTP中代码样例:'操作方式1:'获取DOM对象set oDocument = Browser("Browser").Page("Page").Object'使用GetElementByID获取对象元素,并更改文本框WebEdit的v
阅读全文
摘要:'等待页面加载:'使用IE COM启动IESet oIE = CreateObject("InternetExplorer.Application")oIE.Visible = True '设置可见oIE.Navigate "http://www.baidu.com" '跳转URL'等待IE页面加载完毕While oIE.Busy: Wend'利用DOM操作测试对象'(1)通过getElementByID方法获取定位对象,并对其进行操作:'使用IE COM启动IEoIE.Visible =
阅读全文
摘要:非Tab模式:Hwnd = Browser("X").object.HWNDWindow("hwnd:=" & hwnd).MaximizeTab模式:Dim hwndBrw, hwndWindowhwndBrw = Browser("Browser").GetROProperty("hwnd")Const GA_ROOT = 2'Declare Function GetAncestor Lib "user32.dll" (ByVal hwnd As Long, ByVal ga
阅读全文
摘要:Function IsRegEqual(Text, Pattern, IgnoreCase)Dim oRegSet oReg = New RegExpoReg.Pattern = PatternoReg.Global = TrueoReg.IgnoreCase = IgnoreCaseIsRegEqual = oReg.Test(Text)End FunctionFunction SelectUsingPattern(oWebList, Text)Dim oListDom'Get the DOM object of WebListSet oListDom = oWebList.Obje
阅读全文
摘要:Function IsRegEqual(Text, Pattern, IgnoreCase)Dim oRegSet oReg = New RegExpoReg.Pattern = PatternoReg.Global = TrueoReg.IgnoreCase = IgnoreCaseIsRegEqual = oReg.Test(Text)End FunctionFunction GetRowWithRowText(oTable, Text, StartFromRow)Dim oTableDom'Get the DOM Object from the WebTable objectSe
阅读全文
摘要:iStart = 1iEnd = ...WebTable().RowCountDo While iStart < iEndiMiddle = (iStart + iEnd) \ 2value = WebTable.GetCellData(1, iMiddle)iCompare = StrComp(value, strFind)If iCompare = 0 then'Exact match has been foundMsgbox "Value found at - " & iMiddleExit DoElseIf iCompare = 1 then&
阅读全文

浙公网安备 33010602011771号