Hi Neil, Have included the 'x' property in object recognition and it works a bit better.
Will speak to developer about including a html identifier. Thanks for all your help. I needed it. Cheers Steve On Wed, Feb 9, 2011 at 12:00 AM, Neil Ellsworth <[email protected]>wrote: > There are a couple of quick things to try first. If you have a good > working relationship with your developers you can get them to include an > html id value for each of your buttons. QTP objects love a unique html id > to help identify the objects. > > > > This would be easier to help diagnose seeing of course but I was thinking a > possible solution could be to record the test as > > -enter product code > > -click image 1 > > -click image 2 > > > > > > > > Then code something similar to- > > > > Dim productCode(n) > > productCode(0) > > productCode(1) > > … > > productCode(n) > > > > > > For Each code in productCode > > Browser(Browser").Page("Page_4").WinEdit("product_Code").Set code > > Browser(Browser").Page("Page_4").Image("bt_select_1").click > > Browser(Browser").Page("Page_4").Image("bt_select_2").click > > ‘back or refresh if supported? > > Next > > > > (I would assume you could call in a list of product codes either from an > excel sheet or the data table but the same idea is there to create an array > or iterate through the datatable.) > > > > Is there a back button or do you refresh the page after each submit? I > don’t think I’ve asked that question before. > > > > > > I don’t know about your developers saying the images are called bt_select_1 > and bt_select_2, but they both have the same src value of > http://localhost:8080/kiosk/graphics/bt_select\.jpg?<http://localhost:8080/kiosk/graphics/bt_select/.jpg?> > And > no other differentiating property? > > > > Sent from myPhone > > On Feb 6, 2011, at 10:26 AM, steve mcdonald <[email protected]> > wrote: > > Hi Neil, > Thanks for reply. > > Below are the properties for the bt_select_1 image. The only differences > between the bt_select_1 and the bt_select_2 images are in their abs_y and y > properties. > > When I re-record a click of either image, creating the bt_select_3, > bt_select_4, bt_select_5 etc images, then the abs_y and y properties seem to > increment by about 13 ie the 614 below increments to 627 and the 649 below > increments to 662. > > Can you tell me which property I should apply a regular expression to? > Developers have told me that the images are called bt_select_1 and > bt_select_2. > > (btw the actual path (xpath?) position of bt_select_2 is always fixed at > <td>//tr[6]/td/table/tbody/tr[2]/td[4]/img</td>) > > Kind regards > Steve > > Properties for bt_select_1 image:- > > "Class Name:=Image", > "abs_x:=855", > "abs_y:=614", (bt_select_2 is 649) > "alt:=", > "class:=", > "file name:=bt_select\.jpg", > "height:=40", > "href:=", > "html id:=", > "html tag:=IMG", > "image type:=Plain Image", > "innerhtml:=", > "innertext:=", > "name:=Image", > "outerhtml:=<IMG border=0 src=""graphics/bt_select\.jpg"" width=130 > height=40>", > "outertext:=", > "src:=http://localhost:8080/kiosk/graphics/bt_select\.jpg", > "target:=", > "url:=", > "visible:=True", > "width:=130", > "x:=851", > "y:=501" (bt_select_2 is 530) > > On Fri, Feb 4, 2011 at 5:36 PM, Neil Ellsworth <[email protected]>wrote: > >> 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] >>>> 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 >>> >> >> -- >> 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 >> > > -- > 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 > > -- > 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 > -- 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
