WORKING WITH QTP

TestEveryThinG

Use of index property in QTP

Posted by rajivkumarnandvani on November 28, 2009

Hi ALL,

Some time we use index proerty to idendify the object incase object found more than one with same property.
So before adding index property we have to understand that is this property realy required or not becos incase if an object one(unique in application). in case object unique in application and you add index property for that it increase the time to identified the object. In QTP 9.2 it taking more time with respect to QTP 9.5

Here i am showing an example that will show the time calculate withuse of index/creationtime property and without use of this and shows the time difference to execute the steps
First open the QTP application with WEB adding and copy the script in QTP
now open the browser(IE) after open the browser run the script

rem with creationtime

set objBrowser = Description.Create()
objBrowser(“micclass”).value =”Browser”
objBrowser(“CreationTime”).value=0
a= timer
print “with creation time” & Browser(objBrowser).GetROProperty(“title”)
print timer-a

Set objBrowser = nothing

rem without creationtime

set objBrowser = Description.Create()
objBrowser(“micclass”).value =”Browser”

b= timer

print “without creation time” & Browser(objBrowser).GetROProperty(“title”)
print timer-b

Set objBrowser = nothing

Advertisements

4 Responses to “Use of index property in QTP”

  1. Sanjay Kumar said

    Hi

    Using this Vbs Code you can shutdown the any system. Just you have copy the code and put into the vbs file format, click on it
    an confermatiom text will be appears and after confermation your system will be shout down.
    Rem code start———
    Public Function username
    Dim objNet
    Set objNet = CreateObject(“WScript.NetWork”)
    username1 = objNet.ComputerName
    Set objNet = Nothing
    username=Trim(username1)
    End Function

    options=ShutdownOption

    Public Function ShutdownOption
    Dim testMsg2
    testMsg2 = MsgBox(“Do you want Shutdown the system?”, vbYesNoCancel + vbExclamation, “Test Message”)
    If testMsg2 = 6 Then
    msgbox “You are continue the shut down the system”
    ShutdownOption=testMsg2
    Exit function
    ElseIf testMsg2 = 7 Then
    msgbox ” You have stop the shut down of system”
    ShutdownOption=testMsg2
    Exit function
    Else
    msgbox ” you are cancel the shut down of system”
    ShutdownOption=testMsg2
    Exit function
    End If
    End Function

    If options=6 then
    strComputer = username
    Set objWMIService = GetObject(“winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\” & strComputer & “\root\cimv2”)

    Set colOperatingSystems = objWMIService.ExecQuery(“Select * from Win32_OperatingSystem”)

    For Each objOperatingSystem in colOperatingSystems
    objOperatingSystem.Win32Shutdown(1)
    Next
    end if
    Rem end the code

  2. Great Sanjay,
    Keep it up. Thanks for knowledge share
    Good JOB….

  3. Jawahar said

    Hi followed the steps you mentiones that QTP not recording. I try to record simple test to see wheather google search is working. All I got is the following script:

    “With Window(“Windows Internet Explorer”)
    .Activate
    .Activate
    .Close
    End With”

    Please help me to find out why qtp10 is not recording.
    Other things are ie8, windows 7

    Thanks

    Jawahar

  4. hI
    refer this one instead of here
    https://rajivkumarnandvani.wordpress.com/2010/04/21/qtp-not-recording-web-application-in-vista/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: