Monday, November 9, 2015

Learn QTP scripting in 5 Minutes...

Yes, you can start QTP scripting with in 5 minutes, how?

Suppose you want to automate Mercury Application, you will follow the steps:

1. Will launch the QTP and Application
2. Will open the OR to add objects
3. Will start writing script i.e.

Dialog("Login").WinEdit("Agent Name:").Set "mercury"  'Desktop App'
Browser("google).Page("google").WebEdit("abc").Set "Testing"

But what is Dialog/Browser/Page or WinEdit/WebEdit? and Where it comes from?














Dialog is an object of Dialog class and it has a property name "text" and value "Login".

To start writing script go to the root in Object Repository and select the root object (See Login).
Now see its Class under Object Properties that is "Dialog", you can also see "text" property and it's value "Login" in Description properties.

Type "Class(" in Expert View you will see the property comes automatically and close the bracket..

Dialog("Login")




Now select the next object in Object repository, see it's Class "WinEdit" under Object properties and property "attached text" with value "Agent Name:" in Description properties

Dialog(//"Login").WinEdit(..//"Agent Name:")






















Now, you don't have any object left in Object Repository side, it indicates you have reached to the object on which you will apply the action.

Dialog(//"Login").WinEdit(..//"Agent Name:").Set "mercury"

Here, "Set" is a QTP method.

Now you have one step ready for Agent Name text box.

Similarly you can generate the step for Password textbox and Ok button.

Dialog(//"Login").WinEdit(..//"Password").Set "mercury"
Dialog(//"Login").WinButton(..//"OK").Click




No comments:

Post a Comment