- onchange
- onclick
- ondblclick
- onblur
- onfocus
- onmousedown
- onmouseup
- onmouseover
- onmouseout
- onsubmit
- onreset
- onpropertychange
Automation Testing with QTP (Quick Test Professional), HP QTP, HP UFT, HP Unified Functional Testing
Thursday, November 10, 2011
How to use the FireEvent method when a click does not work
What is DOM? and How to use DOM properties in QTP?
The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents. Aspects of the DOM (such as its "Elements") may be addressed and manipulated within the syntax of the programming language in use. The public interface of a DOM is specified in its application programming interface (API).
how the browser display's objects in the browser
DOM
|-> Window
|-> Document
|-> Anchor
|-> Link
|-> Form
|-> Text-box
|-> Text Area
|-> Radio Button
|-> Check Box
|-> Select
|-> Button
QTP will be able to access to Internet Explorer Document Object Model (DOM) through which we will be able to access the HTML tags directly. Access to the DOM is performed using the .Object notation.
below function explains how to iterate all the tags in an Internet Explorer page. The function then outputs the inner-text of the tags (the text contained between the tags) to the Test Results using the Reporter object.
' we are using On Error Resume Next option because all the page elements might not have inner-text.
On Error Resume Next
Set Doc = Browser("CNN Interactive").Page("CNN Interactive").Object
' Loop through all the objects in the page.
For Each Element In Doc.all
TagName = Element.TagName ' Get the tag name.
InnerText = Element.innerText ' Get the inner text.
' Write the information to the test results.
Reporter.ReportEvent 0, TagName, InnerText
QTP 11 Now Supports Google Chrome
HP Patch QTPWEB_00088 features and limitations
HP just released a new patch QTPWEB_00088 that contains the following features and limitations:
QTP does not support recording steps in Google Chrome
Certain Google Chrome Javascript functionality, like web pages that use JSON objects, may cause unexpected behavior in QTP.
If you manually uninstalling the QTP agent extension from Tools>Extensions, you must manually reinstall it if you reinstall this patch.
Browser methods will not be supported
Also the following methods are not supported:
Browser.Home
Brpwser.Fulscreen
Browser.ClearCache
Browser.Objects
Running steps not supported:
Chrome: //* pages
Multiple tabs
Multiple browsers
Web pages that include frame sets
WebXML test objects
Web test objects located inside iFrame controls with a'blank' or 'about:blank 'SRC in property value
Developers Tools Pane but running against Google Chrome while the developers tools pane is open is supported
Web 2.0 test objects or Web Extensibility-based test objects
Web-based env, such as SAP Web, Siebel, Java, .NET Webforms etc..
Click here to Download QTPWEB_00088 Patch
Thanks to Joe for such valuable information http://www.joecolantonio.com/2011/11/02/qtp11-now-supports-google-chrome-patch-qtpweb_00088/
Friday, October 14, 2011
Close all Browsers Opened Except QC
Dim intIndex
Set oDesc=Description.Create
oDesc("micclass").Value="Browser"
intIndex=0
While Browser("micclass:=Browser","index:="&intIndex).exist(0) and intIndex<Desktop.ChildObjects(oDesc).count
If instr(1, Browser("micclass:=Browser","index:="&intIndex).getRoProperty("name"),"Quality Center") = 0 Then
SystemUtil.CloseProcessByHwnd( Browser("micclass:=Browser","index:="&intIndex).getRoProperty("hwnd"))
else
intIndex=intIndex+1
End if
wend
How to Search for a particular value in Excel ?
Using the below script, we will be able to search a particular value in the excel file.
*******************************************************************************************
Set appExcel = CreateObject("Excel.Application")
appExcel.visible=true
Set objWorkBook = appExcel.Workbooks.Open (filepath) 'opens the sheet
Set objSheet = appExcel.Sheets("Sheet1″)' To select particular sheet
With objSheet.UsedRange ' select the used range in particular sheet
Set c = .Find ("nn")' data to find
For each c in objSheet.UsedRange' Loop through the used range
If c="nn" then' compare with the expected data
c.Interior.ColorIndex = 40′ make the gary color if it finds the data
End If
Set c = .FindNext(c)' next search
next
End With
objWorkBook.save
objWorkBook.close
set appExcel=nothing
**********************************************************************************************
