Saturday, 17 August 2013

How to Read All the Data from a Webtable

Set ItenCount = Browser(”…”).Page(”…”).WebTable(”…”)
RCount = ItenCount.GetROProperty(”rows”)
Ccount = ItenCount.GetROProperty(”cols”)
For i = 1 to RCount
For j = 1 to Ccount
CData = ItenCount.GetCellData(i,j)
msgbox CData

How to Capture Tool Tip of a Web Element Using QTP

Use GetRoproperty(”alt”)

How to Clear Windows Event Logs in XP Using Script

strComputer = “.”
Set objWMIService = GetObject(”winmgmts:” _
& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2″)
Set colLoggedEvents = objWMIService.ExecQuery _
(”Select * from Win32_NTLogEvent Where Logfile = ‘System’” _
& ” and SourceName = ‘SaveDump’”)
For Each objEvent in colLoggedEvents
Wscript.Echo “Event date: ” & objEvent.TimeGenerated
Wscript.Echo “Description: ” & objEvent.Message
Next

Little Facts About QTP

1. Automation Framework – Framework is the folder structures which contains folders, sub-folders and files that can be access by across the team. There are 5 types of frameworks. Linear, Data-driven, Modular, Keyword Driven,
Hybrid frameworks. As per project requirement, appropriate framework is used -
2. Descriptive Programming – The description of the object we are specifying the directly in the
test script is called descriptive programming. By using DP we can prepare test scripts without using QTP.
3. GetRow() – Get row is used to count no of values in a row
4 What is meant by Common functions and What are the Common Functions
available in QTP – Common functions are the functions which we are used regularly in the test script. There is no common functions in QTP. Which we are created User Defined Function, in these functions some functions are we are using regularly. These functions are will make it as a common functions folder, other functions goes to User Defined Functions.

QTP – How to append value in Data Table cell

Code to append value in Data Table Cell –
‘ Set cursor to desired row of Data Table
DataTable.SetCurrentRow(2)
‘This code first reads value from Cell, concatenate existing value & new value, value is stored in cell –
Datatable.Value(”Column Name”,”Sheet name”) = Datatable.Value(”Column
Name”,”Sheet name”)+str_ValueToAppend