Ok, two things I would suggest.
1. The best practice for coding in general would be to reuse as much as
possible, make your life easy.  Record your test case as
-enter product code
-click image 1
-click image 2

then stop recording and use this code and encapsulate it.  I would wrap it
in a function (or subroutine)

i.e.
Public Function productCodeTest()
      Browser(Browser").Page("Page_4").WinEdit("product_Code").Set "12345"
     Browser(Browser").Page("Page_4").Image("bt_select_1").click
     Browser(Browser").Page("Page_4").Image("bt_select_2").click
End Function

you would then either link to an external excel sheet or use the data table
to hold  your product code values and iterate through them all.

You would most likely need a driver function to loop through all the product
codes, a for loop that would call " productCodeTest" as per my example above
and iterate until all the product codes you want to test have been used.

2. And as was suggested it looks like you might have to use regular
expressions to find the two images you are describing as their initial
descriptions seem very similar and if QTP cant distinguish them.  You can do
this in the Object repository,  highlighting the element in question and
configure the values, there will be a check box to use regular expression.



let me know if this helps or if more details are needed

Neil


On Fri, Feb 4, 2011 at 10:13 AM, steve mcdonald
<[email protected]>wrote:

> Hi Neil,
> 2nd scenario
>
> -enter product code
> -click image 1
> -click image 2
> -enter product code
> -click image 1
> -click image 2
> -enter product code
> -click image 1
> -click image 2
> Etc
>
> Steve
>
>
>
>
> On Fri, Feb 4, 2011 at 5:08 PM, Neil Ellsworth <[email protected]>wrote:
>
>>  For clarification, when you are recording have you;
>> -enter product code
>> -click image 1
>> -click image 2
>> (stop recording and iterate)
>>
>> Or
>> -enter product code
>> -click image 1
>> -click image 2
>> -enter product code
>> -click image 1
>> -click image 2
>> -enter product code
>> -click image 1
>> -click image 2
>> Etc until you have recorded entire test case?
>>
>> Neil
>>
>> Sent from myPhone
>>
>> On Feb 4, 2011, at 10:02 AM, Naveen Arora <[email protected]> wrote:
>>
>>  Steve,
>>
>>            As according to the below scenario,  Here you can perform
>> Regular Expression only on numbers...
>>
>> Gratitude,
>> Nunny
>>
>> On Fri, Feb 4, 2011 at 2:14 PM, steve mcdonald <<[email protected]>
>> [email protected]> wrote:
>>
>>> Hi Garvin,
>>> Thanks for link and have read through.
>>>
>>> I am quite comfortable with datatables and have 50+ rows already set up.
>>> The problem is with the Image object dynamically changing
>>> from Image("bt_select_1"), Image("bt_select_2") as coded by developers
>>> but being rendered as Image("bt_select_3"), Image("bt_select_4"), ...,
>>> Image("bt_select_99") etc as I record.
>>>
>>> Cheers
>>> Steve
>>>
>>>   On Thu, Feb 3, 2011 at 8:01 PM, Garvin Sutton < <[email protected]>
>>> [email protected]> wrote:
>>>
>>>> Steve if you are basically running through your script twice then you
>>>> only need to record the objects (images) once then iterate through them
>>>> again using parameters that you can set in your data table.  For a newbie
>>>> this would be easier then jumping into descriptive programing at this 
>>>> stage.
>>>>
>>>>
>>>> Here is a good tutorial in using data tables for setting parameters
>>>>
>>>> <http://relevantcodes.com/introduction-to-parameterization-qtps-local-datatable/>
>>>> http://relevantcodes.com/introduction-to-parameterization-qtps-local-datatable/
>>>>
>>>>
>>>>
>>>>   On Thu, Feb 3, 2011 at 12:22 PM, steve mcdonald 
>>>> <<[email protected]>
>>>> [email protected]> wrote:
>>>>
>>>>>   Hi,
>>>>> In my script I enter a product code and then click 2 images and QTP
>>>>> records -
>>>>> Browser(Browser").Page("Page_4").Image("bt_select_1").click
>>>>>  Browser(Browser").Page("Page_4").Image("bt_select_2").click
>>>>>
>>>>> yet when I enter a second product code and then click the same images
>>>>> it records them as
>>>>>  Browser(Browser").Page("Page_4").Image("bt_select_3").click
>>>>>  Browser(Browser").Page("Page_4").Image("bt_select_4").click
>>>>>
>>>>> Should I use descriptive programming to solve the problem to avoid
>>>>> using the OR?
>>>>>
>>>>> Any sample code would be appreciated. (Am a newbie and have spent 2
>>>>> days on this so far!).
>>>>>
>>>>> Thanks
>>>>> Steve
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> "QTP - HP Quick Test Professional - Automated Software Testing"
>>>>> group.
>>>>> To post to this group, send email to <[email protected]>
>>>>> [email protected]
>>>>> To unsubscribe from this group, send email to
>>>>> <mercuryqtp%[email protected]>
>>>>> [email protected]
>>>>> For more options, visit this group at
>>>>> <http://groups.google.com/group/MercuryQTP?hl=en>
>>>>> http://groups.google.com/group/MercuryQTP?hl=en
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> "QTP - HP Quick Test Professional - Automated Software Testing"
>>>> group.
>>>> To post to this group, send email to <[email protected]>
>>>> [email protected]
>>>> To unsubscribe from this group, send email to
>>>> <mercuryqtp%[email protected]>
>>>> [email protected]
>>>> For more options, visit this group at
>>>> <http://groups.google.com/group/MercuryQTP?hl=en>
>>>> http://groups.google.com/group/MercuryQTP?hl=en
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> "QTP - HP Quick Test Professional - Automated Software Testing"
>>> group.
>>> To post to this group, send email to <[email protected]>
>>> [email protected]
>>> To unsubscribe from this group, send email to
>>> <mercuryqtp%[email protected]>
>>> [email protected]
>>> For more options, visit this group at
>>> <http://groups.google.com/group/MercuryQTP?hl=en>
>>> http://groups.google.com/group/MercuryQTP?hl=en
>>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> "QTP - HP Quick Test Professional - Automated Software Testing"
>> group.
>> To post to this group, send email to <[email protected]>
>> [email protected]
>> To unsubscribe from this group, send email to
>> <[email protected]>
>> [email protected]
>> For more options, visit this group at
>> <http://groups.google.com/group/MercuryQTP?hl=en>
>> http://groups.google.com/group/MercuryQTP?hl=en
>>
>>   --
>> You received this message because you are subscribed to the Google
>> "QTP - HP Quick Test Professional - Automated Software Testing"
>> group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<mercuryqtp%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/MercuryQTP?hl=en
>>
>
>  --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<mercuryqtp%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to