Geeks Talk

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.

Is there a way to select dynamic data of an object in run time?

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 ...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 10-16-2009
Junior Member
 
Join Date: Oct 2009
Location: VN
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
joshasha is on a distinguished road
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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-16-2009
Expert Member
 
Join Date: Jun 2008
Posts: 212
Thanks: 6
Thanked 12 Times in 11 Posts
learqtptesting is on a distinguished road
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
Reply With Quote
  #3 (permalink)  
Old 10-17-2009
Junior Member
 
Join Date: Oct 2009
Location: VN
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
joshasha is on a distinguished road
Re: Is there a way to select dynamic data of an object in run time?

Quote:
Originally Posted by learqtptesting View Post
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
Thanks for your reply
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.
Reply With Quote
  #4 (permalink)  
Old 10-19-2009
Junior Member
 
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
ImamUrs is on a distinguished road
Re: Is there a way to select dynamic data of an object in run time?

hi Friend,

Use Regular Expression for WebList object, then you can pass any dynamic data.


please let me know if i wrong
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


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


All times are GMT -4. The time now is 09:09 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved