- Descriptive Programming In Qtp Pdf Example
- Descriptive Programming In Qtp Examples
- Descriptive Programming In Qtp Pdf Converter
- Descriptive Programming In Qtp Pdf Tutorial
However, you cannot use Browser(Dbrowser).Page(Dpage).Link(“Example1”), since it uses Descriptive Programming for the Browser and Page objects but then attempts to use an object repository name for the Link test object (UFT tries to locate the Link object based on its name, but cannot locate it in the repository because the parent objects were specified using Descriptive Programming). This tutorial demonstrates how to use Descriptive programming in your QTP scripts its two type viz. Dynamic descriptive programming in qtp pdf QTP Descriptive project of finance in pdf Programming Unplugged is an in-depth reference and guide on using HP QTP Test Objects. A must-have for every user, from. QTP Descriptive Programming Unplugged is an in-depth reference and guide on using HP QTP Test Objects. A must-have for every user, from beginner to expert, this comprehensive book will help you to master a range of Object Identification techniques in QTP. Descriptive programming is a way for QTP to bypass Object Repository(OR). In this tutorial i will show how to do Descriptive programming. If we want to perform an operation on an object that is not stored in the object repository then we use Descriptive programming. Descriptive programming in QTP is a way to interact with the objects that are not there in the Quicktest Professional Object repository. Before discussing Descriptive programming in details, I will firstly discuss how QTP identifies objects present in the Object Repository.
Descriptive Programming In Qtp Pdf Example
In the previous article, we saw the basics of Descriptive Programming in QTP. In this article, we will discuss few more important concepts that will help you use descriptive programming more effectively. Let’s see each of these concepts one by one.
Using Regular Expressions in Descriptive Programming
Consider the following scenario – You have to write a script where you have to click on the inbox link in GMail. But you would have noticed that the number of unread emails is also displayed together with the Inbox link in GMail. Also, the number of unread emails changes very frequently.
So how do you handle such scenarios when you use Object Repository? Yes, you use Regular Expression when specifying the object property in OR. Well, you can use the same regular expressions concept with Descriptive Programming also. Let’s see how this is done.
Now when you don’t have any unread mails in GMail, the inbox link will be displayed as ‘Inbox’ but in case there are any unread mails, it is appended with the Inbox text as Inbox(2), Inbox(14) etc. Here you will notice that the common text in both the cases is ‘Inbox’. The most basic regular expression that we can use here is Inbox.* . And for the link, the regular expression would look like Link(“innertext:=Inbox.*”). The complete code is shown below –
In the above code, we have used regular expression for Browser and Page title also. This is done because when you open any mail in Gmail, some text gets appended after Gmail in the title. So this code will work from Inbox as well as from some other page in Gmail.
Using Description Object in Descriptive Programming
In the first part of Descriptive Programming in QTP series, we covered the most basic method of using Descriptive Programming where you specify the object property and value directly with the statement. This approach is shown below.
Here you can notice that the object property for browser and page objects are specified multiple times. Now suppose that the this property gets changed at some point in the future. In such a scenario, you would have to do a lot of rework to update the scripts. To avoid this, you can use an alternative method where you can specify the object properties and methods in Description Object and then use this object in your statement. Below code highlights this approach.
Alternatively you can use one more method to shorten your code –
In both the above cases, the object property and value is written at only a single place. So if there is any change in the object property, it needs to be done at few places and thus the amount of rework is significantly reduced.
Combining both Object Repository and Descriptive Programming
You can combine both Object Repository and Descriptive Programming approaches in your scripts. While doing so you have to take care of one thing. In the same statement, you can start with OR and then use DP, but you cant do it the reverse way. That is, you can’t first use DP and then move over to OR. The below code illustrates this concept.
Descriptive Programming In Qtp Examples
Using Ordinal Identifiers in Descriptive Programming
Many a times when you write scripts, you might need to include ordinal identifiers (index, creation time, location) in the object repository. You can use ordinal identifiers in Descriptive Programming also. Let’s see an example for the same.
Example: Ordinal Identifiers in Descriptive Programming. In this example,the code will open 2 internet explorer browsers and open different URLs in both the browsers.
Based on the Creation Time ordinal identifier, the above code opens google.com in the first browser and yahoo.com in the second browser.
In the next article in this series, we will see some examples of Descriptive Programming. Meanwhile, if you have any inputs, feedback, queries regarding this article or this topic, you can let us know about it using the comments section.
Descriptive Programming In Qtp Pdf Converter
If you enjoyed this article, you can join our blog to get new articles delivered directly in your inbox.
To check out more tutorials, visit our QTP Tutorials page. You can also check the Archives page to view the list of all our articles.
Descriptive Programming In Qtp Pdf Tutorial
Related posts: