Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Descriptive Programming within the QTP forums, part of the Software Testing category; Hi, 1.Can anybody give a sample code of Descriptive programming in QTP?(Not Definitions). 2. How can you test a Dynamic moving objects using QTP? If Tested? What is the code ...
|
|||||||
|
|||
|
Descriptive Programming
Hi,
1.Can anybody give a sample code of Descriptive programming in QTP?(Not Definitions). 2. How can you test a Dynamic moving objects using QTP? If Tested? What is the code for that? |
| The Following User Says Thank You to thotaravikiran For This Useful Post: | ||
| Sponsored Links |
|
|||
|
Re: Descriptive Programming
If we do only Descriptive programming in QTP without recoding, will the objects be identified in Object Repository and will the test run execute?
|
|
|||
|
Re: Descriptive Programming
You can write a QTP script using descriptive programming without recording.
You can use object spy to specify the object's properties so that it can be identified. Note that the object repository is empty in this case but the script runs fine. For example, following is the code I wrote to check this out. It just searches for some string on google. This runs the first time without any recording: =========== Dim GBrowser : Set GBrowser=Browser("name:=Google.*") Dim GPage : Set GPage=GBrowser.Page("title:=Google.*") URL="http://www.google.com" SystemUtil.run "iexplore",URL GPage.WebEdit("name:=q","type:=text","html tag:=INPUT").Set "qtp" GPage.WebButton("name:=Google Search","index:=0","type:=submit","html tag:=INPUT").Click ===================== Please let me know if I am wrong. Thanks. |
| The Following 3 Users Say Thank You to ahuja1234 For This Useful Post: | ||
|
|||
|
Re: Descriptive Programming
Hey guys first of all be aware of onething, For Descriptive programming Object repository is not required ..There is nothing to do with Object Repository if we are doing scripting descriptively..
Like our friends said in the above posts, We can use n number of attributes for scripting descriptively |
|
|||
|
[QUOTE=thotaravikiran;20] 1.Can anybody give a sample code of Descriptive programming in QTP?(Not Definitions).
QUOTE] EG... Browser("BrowserName").Page("PageName").WebEdit("name:=Login","index:=0").Set "John" Here, "name" is one general property and "index" is the unique property Quote:
Quote:
Quote:
This is really is good piece of code even we practice something like this Last edited by jainbrijesh; 05-19-2007 at 05:59 AM. |
|
|||
|
Re: Descriptive Programming
[QUOTE=debleena23;10567]
Quote:
dim,why?can u explain me pls? |
|
|||
|
Re: Descriptive Programming
I must say... this is a smart piece of code from Ahuja.
We use Object Spy to get the properties and their values to uniquely identify the objects in the application. If we know such properties and their unique values that can identify the required object without ambiguity, we need not use Object Spy. Instead of using --Browser("name:=Google.*")-- in the code each time we want to refer to the browser, we can set it as an object by declaring a variable with Dim statement. Now, the variable can be used as a shortcut for all references to the browser window and the web page. The above program can be written using "With" statement where we don't have to declare the variables using Dim. *********** With Browser("name:=Google.*").Page("title:=Google.*") URL="http://www.google.com" SystemUtil.run "iexplore",URL .WebEdit("name:=q","type:=text","html tag:=INPUT").Set "qtp" .WebButton("name:=Google Search","index:=0","type:=submit","html tag:=INPUT").Click End With ***********
__________________
Lack of WILL POWER has caused more failure than lack of INTELLIGENCE or ABILITY. -sutnarcha- Last edited by sutnarcha; 07-08-2008 at 09:09 AM. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C Programming - Linked Lists | Lokesh M | C and C++ | 1 | 03-05-2007 07:02 AM |
| C Programming - File management in C | Lokesh M | C and C++ | 0 | 05-31-2006 04:35 PM |
| C Programming - Dynamic Memory allocation | Lokesh M | C and C++ | 0 | 05-29-2006 03:35 AM |
| C Programming - Structures and Unions | Lokesh M | C and C++ | 0 | 05-26-2006 02:06 AM |
| C Programming - Pointers | Lokesh M | C and C++ | 0 | 05-26-2006 02:05 AM |