Micro Focus QTP (UFT) Forums
How to record script in QTP? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to record script in QTP? (/Thread-How-to-record-script-in-QTP)



How to record script in QTP? - ashita - 08-30-2011

Hi,

I am new to QTP. I am facing problem to record script.
Can anyone give me the step by step procedure to record script for Login page.

Thanks in advance
Ashita Sad


RE: How to record script in QTP? - Forrest Gump - 08-31-2011

Hi Ashita,

Here are the steps you need to follow:
1. Open QTP. (Select ActiveX and Visual Basic from home screen)
2. Open Flight Application (For Example: "E:\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe")
3. Click "Record" button in QTP (You can find it in top left corner of the screen or simply Press "F3" key or Goto Automation Menu >> Record.
4. "Record and Run Settings" window will open. (Select "Window Application" tab)
5. By default first radio button will be selected.
6. Click ok (Now QTP will be in recording mode)
7. Select "Flight Login" dialog from taskbar or by pressing Allt+Tab
8. By default cursor will be blinking at "Agent Name" text field.
9. Enter Agent Name
10. Click on Password with the help of mouse. (Please dont hit 'Tab' key. Please avoid keystrokes when using QTP or LoadRunner)
11. Enter password as "mercury"
12. Click on "OK" or "Cancel" as per your requirement. (Here for demo purpose I choose "Cancel")
13. Click on "Stop" button or press "F4" to stop recording.
14. If you followed above steps, then you can see below script generated in "Expert View" in QTP

Code:
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "forrest"
Dialog("Login").WinEdit("Password:").SetSecure "4e5d6a8e3c95d0b55b8d07a54411012a0a6f2821"
Dialog("Login").WinButton("Cancel").Click

Please reply whether its worked or not. If not, then please mention clearly the method you are following when recording.

Regards,
- Forrest Gump


RE: How to record script in QTP? - ashita - 08-31-2011

Hi,

Thanks for your help. It's working.

Thanks
Ashita.


How to do parameterization? - ashita - 09-01-2011

Hi,

I am facing problem in doing parameterization. I am sending you the script for how i am doing parameterization. Tell me where I am doing wrong?

1. First I have created the script for login page.
Agent name, Password and OK button because for recording script these steps remain same.

2. one way of doing parameterziation is I am doing copy paste the script in expert view and change the agent name and password manually.

3. The other way I am using parameterization Below are the steps:

a) Click on keyword view. Then click on the Parameterization icon <=>
b) Value configuration dialog box opens
c) Click radio button parameter
By default it takes name P_text
I renamed it Agentname and then click OK.

d) In the global data sheet the column name Agent name is created and value guru automatically comes.

script for this is below:
Code:
invokeapplication("C:\ProgramFiles(x86)\MercuryInteractive\QuickTestProfessional\bin\QTPro.exe")
dialog("Login").WinEdit("AgentName").SetDataTable("agentname,dtGlobalSheet")
dialog("Login").WinEdit("Password").SetDataTable("password,dtGlobalSheet")
dialog("Login").WinButton("OK").Click
Wait(1)


Now When i Try to run this It's giving me an error.
Cannot find the "AgentName" object "Parent Login"(class Dialog). Verify that parent properties match an object currently displayed in your application.

Please help me in parameterization.
:-(
Thanks & Regards,
Ashita


RE: How to do parameterization? - SQT - 09-01-2011

Change your script as below:

Code:
invokeapplication("C:\ProgramFiles(x86)\MercuryInteractive\QuickTestProfessional\bin\QTPro.exe")
dialog("Login").WinEdit("AgentName").Set DataTable("agentname",dtGlobalSheet)
dialog("Login").WinEdit("Password").Set DataTable("password",dtGlobalSheet)
dialog("Login").WinButton("OK").Click
Wait(1)

Check your column name carefully ,It should be "agentname" , "password" in global sheet.


RE: How to do parameterization? - ashita - 09-01-2011

Hi,

I tried above script which u post it..
Now I am getting run time error

The Operation cannot be performed..

Why is this So?

Can you please help me...

Thanks
Ashita


RE: How to record script in QTP? - ashita - 09-02-2011

Hello Paul,

When you get resolution for this query. Do reply me.
Thanks
ashita


RE: How to do parameterization? - Forrest Gump - 09-05-2011

(09-01-2011, 03:11 PM)ashita Wrote: [quote='SQT' pid='17856' dateline='1314867201']
Change your script as below:

invokeapplication("C:\ProgramFiles(x86)\MercuryInteractive\QuickTestProfessional\bin\QTPro.exe")
dialog("Login").WinEdit("AgentName").Set DataTable("agentname",dtGlobalSheet)
dialog("Login").WinEdit("Password").Set DataTable("password",dtGlobalSheet)
dialog("Login").WinButton("OK").Click
Wait(1)

Check your column name carefully ,It should be "agentname" , "password" in global sheet.


Hi,

I tried above script which u post it..
Now I am getting run time error

The Operation cannot be performed..

Why is this So?

Can you please help me...

Thanks
Ashita

Hi Ashita and Hi Paul,

Try this below code: It will work 100%

Quote:Invokeapplication("C:\ProgramFiles(x86)\MercuryInteractive\QuickTestProfessional\bin\QTPro.exe")
Dialog("text:=Login").activate
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").set DataTable("agentname",dtGlobalSheet)
Dialog("text:=Login").WinEdit("attached text:=Password:").set DataTable("password",dtGlobalSheet)
Dialog("text:=Login").WinButton("text:=OK").Click
Window("text:=Flight Reservation").WinButton("object class:=Button").WaitProperty "enabled", 0, 500000
Window("text:=Flight Reservation").close

Please do reply guys.