Two Buttons with Same Name but different Values


#1

Hi, I have a page with two button events next to each other.

The first is: input style=“font-size: 10” value=“Reset” name=“ACTION_REQUEST” type=“reset”

The second is: input style=“font-size: 10” value=“Execute” name=“ACTION_REQUEST” > type=“submit”

When replaying the script, the job is getting confused and selecting the “Reset” button instead of the “Execute”. I want to select the second button to “Execute”.
Can you think of way to tell Kantu to distinguish between the two and select “Execute”? And example would also be great as I can’t find one in the included demos.

Thanks, David


#2

When you record the buttons, what locator do you get? Can you please include a link to the website (then we can create a solution for you right way)? Alternatively another website that shows the same issue would be very helpful as well.

Here is a first hint: Use index based xpath like //input[1] and //input[2] and so on.

A similar (but not the same) issue is described here: How to click a button with a changing ID (partial ID match)?


#3

Unfortunately, the site it on an intranet and you will not be able to get to it.

image

I’m not clear on what you mean by “what locator do you get”.

Thanks, David


#4

Well, it finally makes sense to me now. In order to find the XPath settings, you have to edit the recording after the click event occurs and before the next step in the script. In my case, I edited the Click event to the below and now the script selects the correct button. Thank you very much for your tip!

/html/body/form/table/tbody/tr[4]/td/table/tbody/tr/td/table[5]/tbody/tr/td[2]/input