Sunday, May 22, 2011

QTP 10 Menu Item Missing

Try the below steps, You will get your menu item's back.


Step1: Launch QTP.
Step2: Right click on the top of toolbar
Step3: Select Customize ---> Select Toolsbar Tab ---> Click on Restore All

Monday, May 16, 2011

How to use key strokes in QTP?


'Problem: Sometimes it happened that QTP is not recognizing the objects. Can i use keyboard strokes to click any of the link and Navigate the different parts of open application.

'Solution: 
'Use of KeyStroke on Active Browser/Window
Set Obj=CreateObject("WScript.Shell")
wait 2
Obj.Run "http://www.google.com"
wait 2
     Obj.SendKeys "{Enter}"
  wait 2
  Obj.SendKeys "{Tab}"
  wait 2
     Obj.SendKeys "{Enter}"
  wait 2
  Obj.SendKeys "{Tab}"
  wait 2
  Obj.SendKeys "{Tab}"
  wait 2
  Obj.SendKeys "{Tab}"
  wait 2
  Obj.SendKeys "{Tab}"
  wait 2
  Obj.SendKeys "{Tab}"
  wait 2
  Obj.SendKeys "{Tab}"
  wait 2
  Obj.SendKeys "{Tab}"
  wait 2
  Obj.SendKeys "{Enter}"
         
'The above code will
1.  Launch "Google.com"
2.  Click on link "Advanced Search"
3.  Click on link "Google Instant" within Advanced Search Page

How to Close Multiple Browser? QTP

Problem: I have 10 open Browsers, How can i close them 1 by 1.

Solution:

'Close All the Open Browser
While Browser("title:=.*","index:=0").Exist
Browser("title:=.*","index:=0").close
Wend