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 Is there a way to select dynamic data of an object in run time? within the QTP forums, part of the Software Testing category; Hi everyone, I am a new person using QTP to develop test script. I am writing the test script to verify adding some products with different options to a cart ...
|
|||||||
|
|||
|
Is there a way to select dynamic data of an object in run time?
Hi everyone,
I am a new person using QTP to develop test script. I am writing the test script to verify adding some products with different options to a cart of web application. I wonder how to identify dynamic options of these products in run time. I used datatable with the column "ProductID" which is described as inputted parameter. It means that I only input the static Product ID from the datatable to "Search" field of web page and I want to execute the script to automatically select an option item in each group from the specified Product ID (not to select specified options as below and I also don't want to input static options into datatable) then add it to the cart. Please help me find a way to solve it. Here are some recorded scripts when using the Record functionality: Browser("IE").Page("Shopping site").WebEdit("keywords").Set DataTable("ProductID", dtGlobalSheet) Browser("IE").Page("Shopping site").Image("find our site").Click 8,5 Browser("IE").Page("Product").WebEdit("qty").Set "3" 'it means that I select the option item 1 from option group 1 "id[MGP915]" Browser("IE").Page("Product").WebList("id[MGP915]").Select "Amber Color" 'it means that I select the option item 2 from option group 2 "id[MGP899]" Browser("IE").Page("Product").WebRadioGroup("id[MGP899]").Select "OPT3522" Browser("IE").Page("Product").Image("In Cart").Click 91,12 Browser("IE").Page("Product").Sync Browser("IE").Close 'end script. Many thanks to quick reply for this case. BR |
| Sponsored Links |
|
|||
|
Re: Is there a way to select dynamic data of an object in run time?
Hope below help your thinking:
1) read ProdID (from your datatable) into a varable 2) use select case on the variable to select the radio button 3) if your datatable contains more than one prodID, utilize loop example, yourProdID = DataTable("ProductID", dtGlobalSheet) select case yourProdID Case "MGP915" browser(b).page(p).weblist(wl).select anItemOrIndex <-> see online help browser(b).page(p).WebRadioGroup(rbg).select anItemOrIndex <-> see online help Case "MGP899" browser(b).page(p).weblist(wl).select anItemOrIndex <-> see online help browser(b).page(p).WebRadioGroup(rbg).select anItemOrIndex <-> see End select Browser("IE").Page("Product").Image("In Cart").Click |
|
|||
|
Re: Is there a way to select dynamic data of an object in run time?
Quote:
Below is an example to add a product to cart (Each product has different number of options which we only see during run time) Example: Step 1. Launch to the website "http://www.lockersupply.com" Step 2. Input a product code, such as LW1376, into Search field. Step 3. Click on "Search" button. Step 4. Select all options for the product if any (For example, select 3 options for Product "LW1376") Step 5. Input a number into Qty field. Step 6. Click on "Add to Shopping Cart" button At Step #3, the number of options varies based on the product code, i.e. there is none, one, or more than one option for a product. So, I want to have a script which is able to automatically select all the possible options of a product, i.e. if a product has 4 options, then 4 of them should be chosen. Could you please give the script to execute the example above? I greatly appreciate your kindness. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to dynamic generate text item run time | sunraajkumar | Oracle | 1 | 07-09-2009 09:26 AM |
| How do we chage the wait time to select OS when we have dual OS on a machine | prakash.kudrekar | Unix/Linux | 2 | 06-25-2009 10:31 PM |
| Dynamic object data Verification point in rational robot | leenaDhande | Rational Robot | 0 | 05-12-2008 02:51 AM |
| Select data for particular time period | Vasanth.sql | Oracle | 2 | 05-05-2008 06:32 AM |
| What does QTP do if a run time object doesn't match with any object in repository? | chennaprashanth | QTP | 4 | 03-28-2008 03:09 AM |