Forum Discussion

tandrews's avatar
tandrews
Occasional Contributor
11 years ago
Solved

Wrong Button Clicked in Keyword Test

I have recorded a keyword test to click a confirm button on a form. However, when I run it, it clicks the deny button. The script behind the form is

<div class="right" id="requestButtons">

           

<div class="affirmativeButton left">

                       

<input class="statusButton" type="image" src="/Content/images/btnConfirm.png" value="Pending Approval">

           

</div>

           

<div class="negativeButton left">

                       

<input class="statusButton" type="image" src="/Content/images/btnDeny.png" value="Returned">

           

</div>

       

</div>

 

The id of these buttons is “request buttons”. But I am attempting to get the automated test to click the confirm status button (btnConfirm.png). But automated test keeps clicking deny status button (btnDeny.png). Although in each case I am telling it to click Confirm. Hopefully, this is a quick solution.

  • Note that the mapping only has "ImageButton" object type as a mapping criteria.  If there is more than one object that will map that way, you may have issues like you've described.



    If I were you, I'd edit that mapping to add additional criteria... something like Caption, Id, or something else that would uniquely identify the button to keep it distinctive of other similar objects.

6 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Note that the mapping only has "ImageButton" object type as a mapping criteria.  If there is more than one object that will map that way, you may have issues like you've described.



    If I were you, I'd edit that mapping to add additional criteria... something like Caption, Id, or something else that would uniquely identify the button to keep it distinctive of other similar objects.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Without knowing exactly what your Keyword test looks like, hard to say.



    However, best guess?



    Most likely your NameMapping or aliasing of your button is ambiguous so it is simply clicking on the first button it comes.  Check your mapping criteria for your button being clicked and see if you need to make some changes in its identifiers.
  • tandrews's avatar
    tandrews
    Occasional Contributor
    Here is the section of the Keyword test info.



    cellRequestId Click ... Clicks at point (47, 17) of the 'cellRequestId' object.

    Set Variable Value ReqNo [Project] Aliases.browser.pageMymome.panelRequesttabs.panelTblactiverequestsWrapper.tableTblactiverequests.cellSorting1.Click 

    imagebutton3 Click ... Clicks at point (77, 20) of the 'imagebutton3' object.

    button2 ClickButton  Clicks the 'button2' control.

    textnodeClose Click ... Clicks at point (2, 14) of the 'textnodeClose' object.

    panelBlockuiBlockoverlay HoverMouse 1514, 126 Moves the mouse pointer over the 'panelBlockuiBlockoverlay' control.



    It clicks imagebutton3 however this clicks an incorrect button.
  • tandrews's avatar
    tandrews
    Occasional Contributor
    Aliases.browser.pageMymome.panelUiDialogUiWidgetUiWidgetCon.imagebutton3



    In the name editor nothing is listed
  • tandrews's avatar
    tandrews
    Occasional Contributor
    Editing the mapping and addiing additional info worked!