I am working with rails 3 and currently writing test with capybara using selenium driver,
I have issue as below
In one form i have 3 button named “save and add another”, “save and continue editing” and “Save”
Now, if i try to save form by capybara as below
click_button 'Save'
Then this throws error called ‘Save’ button with id,title or value not found
Now if i remove the above 2 buttons and then i try that then it works
FYI, My 3 button’s html as below,
<input class="btn" type="submit" value="Save and add another" name="_addanother" data-disable-with="Save and add another">
<input class="btn" type="submit" value="Save and continue editing" name="_continue" data-disable-with="Save and continue editing">
<input class="btn" type="submit" value="Save" name="_save" data-disable-with="Save">
Please let me know if anyone has an idea.
I think the problem is that all the values return a match because they all contain ‘Save’.
Try assigning each one a distinctive id and using that instead.