Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP Tips and Tricks
#21
hi Dude,
thanks for the valuable information.
In our application usually we use the following comment for waittime
Wait(10)

from your trick i use the following code
sVal=Setting.(“DefaultLoadTime”)


but the sVal was always "20"
actually i want to retrive the time taken for page loading(during various actions)

please help me in this regard.

thanks in advance
Reply
#22
(12-21-2011, 05:54 PM)Sathiya Wrote: hi Dude,
thanks for the valuable information.
In our application usually we use the following comment for waittime
Wait(10)

from your trick i use the following code
sVal=Setting.(“DefaultLoadTime”)


but the sVal was always "20"
actually i want to retrive the time taken for page loading(during various actions)

please help me in this regard.

thanks in advance
As i have indicated earlier, the setting changes are not saved once you close/exit qtp.You can use "timer" trick to find no. of seconds a page is taking to load.
Assume your page has an image which is rendered after page is completely loaded.

Dim startTimer,endTimer
startTimer=Timer
while NOT B().P().Image().exist(1)
wend
endTimer=Timer

msgbox "total time taken in seconds:"& endTimer-startTimer
Reply
#23
@Sankalp,The values will be stored somewhere internally, you dont have to worry about that.Just make use of the values anytime even after test run is over!
Reply
#24
This is another cool tip i discovered today.
Suppose you have few webedits on a page and you need to add all of them into a shared object repository,instead of adding individual objects, go to object repository manager>press F6. click on Filter icon,configure only webedits.
Then click on "Learn".
Now all webeidts on the page would appear in the repository.
You can choose mixture of object types as well (eg:webedits and links).
This will save your time if you needed to add lots of objects
Reply
#25
This one is really cool...i'll definetly try it. Thanks
Reply
#26
(02-06-2012, 07:45 PM)rajpes Wrote: This is another cool tip i discovered today.
Suppose you have few webedits on a page and you need to add all of them into a shared object repository,instead of adding individual objects, go to object repository manager>press F6. click on Filter icon,configure only webedits.
Then click on "Learn".
Now all webeidts on the page would appear in the repository.
You can choose mixture of object types as well (eg:webedits and links).
This will save your time if you needed to add lots of objects

Rajpes,

Good short cut to save the time adding the objects into OR.

Is any way add objects like that into existing OR.?




Reply
#27
(02-16-2012, 10:28 AM)MVChowdary Wrote:
(02-06-2012, 07:45 PM)rajpes Wrote: This is another cool tip i discovered today.
Suppose you have few webedits on a page and you need to add all of them into a shared object repository,instead of adding individual objects, go to object repository manager>press F6. click on Filter icon,configure only webedits.
Then click on "Learn".
Now all webeidts on the page would appear in the repository.
You can choose mixture of object types as well (eg:webedits and links).
This will save your time if you needed to add lots of objects

Rajpes,
Good short cut to save the time adding the objects into OR.
Is any way add objects like that into existing OR.?

AddObject method of Mercury.objectrepositoryUtil will be helpful for this. explore it further.






Reply
#28
(02-16-2012, 10:28 AM)MVChowdary Wrote:
(02-06-2012, 07:45 PM)rajpes Wrote: Suppose you have few webedits on a page and you need to add all of them into a shared object repository,instead of adding individual objects, go to object repository manager>press F6. click on Filter icon,configure only webedits.
Then click on "Learn".
Now all webeidts on the page would appear in the repository.
You can choose mixture of object types as well (eg:webedits and links).
This will save your time if you needed to add lots of objects

Rajpes,

Good short cut to save the time adding the objects into OR.

Is any way add objects like that into existing OR.?

You can first export local objects into a shared object repository(.tsr) Then open it in OR manager then add required objects of same type,save it.Delete all objects in your local OR and finally attach this SOR.

Reply
#29
(02-02-2012, 04:59 PM)rajpes Wrote: @Sankalp,The values will be stored somewhere internally, you dont have to worry about that.Just make use of the values anytime even after test run is over!

Hi,
Thanks, 4 ur Reply.
One more query. If I have 2 scripts say A and B, I used settings.Add() in script A and try to use those value in Script B, will it be possible???

Regards,
Sankalp

Reply
#30
(07-27-2011, 04:05 PM)rajpes Wrote: Just a puzzle here,You need print the pattern like below depending on no. of rows

rows=3,
**1**
*212*
32123

rows=4,
***1***
**212**
*32123*
4321234


Code:
r=inputbox ("enter no of rows")
c=(2*r)-1
m=(c-1)/2

ReDim a(r-1,c-1)
For i=0 to r-1
    For j=0 to c-1
        a(i,j)="*"
    Next
Next
'mid of all rows
For i=0 to r-1
  a(i,r-1)=1
Next


'rows manipulation
For i=1 to r-1
    For j=0 to m-1
                'If previous row has a value at next column position,increment it by 1
        If a(i-1,j+1)<>"*" Then
            val=a(i-1,j+1)+2 '2 instead of 1 because i am decrementing 'val' by 1 in next line
            For k=j to m-1
                 val=val-1
                 a(i,k)=val
                a(i,c-1-k)=val
            Next
        End If
    Next
Next

'print
For i=0 to r-1
    For j=0 to c-1
      txt= txt& a(i,j)
    Next
    txt=txt&vblf
Next
msgbox txt
If you have a better tested code, please post it



Hi Rajpes,

Here you go -
Code:
row = inputbox(" enter no. of rows")
    r = row
    c = row*2- 1

    ReDim a(r,c)

    For i = 0 to r-1
        For j = 0 to c-1
            a(i, j) = abs(r -j-1) + 1
            If a(i, j ) > i+1 Then
                a(i, j) = "*"
            End If
            txt= txt& a(i,j)
        Next
        txt=txt&vblf
Next
msgbox txt

If you have better code than this then please post Smile
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)