Forum Discussion

gdave's avatar
gdave
Regular Contributor
2 years ago

Multiple same button with no unique properties

Hi all,

 

This is bit of a tricky situation and I was wondering if someone can help me out.

 

In the below screenshot, the three 'Edit' pencil button on the right does not have any unique properties. As a result, when I design a test to click on 'Edit' button for Mobile Phone section, it clicks on 'Edit' landline phone section. Can someone please advise how do I make it work in absence of any unique properties ?

 

P.S: We use keyword based test

 

 

Thanks

 

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I have something similar,

    and I will usually either get the column and row, or either the appropriate <div> section, or the appropriate parent followed by child item.

     

    If you try and get the parent item "Mobile Phone", it should have children, and one of the child should be the "Edit" button. Use the Object Spy tool to see the structure of your control.

     

    • gdave's avatar
      gdave
      Regular Contributor

      Hi

       

      Thanks for replying.

       

      Yes, it does have a child item. Can you please advise how do I go about using a parent to then click on one of the child here ?

       

      Thanks

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Are you able to get the highlighted control? What does the Object Browser show for this control?

     

    If yes, are you able to get this

     

    You should be able to get he text

     

    Then, you should be able to get the "edit" button

     

     

     

    • gdave's avatar
      gdave
      Regular Contributor

      Hi

       

      I do get the Edit button but the issue here is that I would like to map each edit button to respective category so that when I say click 'Edit' for Mobile Phone it does click on the Edit of mobile phone. But due to lack of unique properties I am unable to do so and it randomly clicks on other edit buttons. Hope this make sense. Thanks

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You will have to define your name mapping or alias name mapping like so

     

    mobilephone.edit

    landlinephone.edit

    fea.edit

     

    The hierarchy or tree structure needs to be correctly defined, so that you can refer to the correct object - you can refer to object using their long names. For example, I have 5 buttons, and I can refer to each button by their long name .Panel("iframewrapper").Frame("iframeResult").Button(1) without using name mappings.