Reputation: 13949
I have two forms with the same action, and submit button text. Only the text inside changes
<li>
<form name="login" method="post" action="">
<input name="returnURL" value="/cap/dashboard/home" type="hidden">
<input name="destURL" value="" type="hidden">
<button name="login" type="submit" class="btn-primary">
<span aria-hidden="true">Continuer</span>
</button>
<h2>textA</h2>
</form>
</li>
<li>
<form name="login" method="post" action="">
<input name="returnURL" value="/cap/dashboard/home" type="hidden">
<input name="destURL" value="" type="hidden">
<button name="login" type="submit" class="btn-primary">
<span aria-hidden="true">Continuer</span>
</button>
<h2>textB</h2>
</form>
</li>
How can I submit the right form ?
Upvotes: 0
Views: 48
Reputation: 54984
You can use form_node
to search for css/xpath:
page.forms.find{|f| f.form_node.at('h2:contains("textB")')}
It wouldn't matter though, in your example both forms do the same thing.
Upvotes: 1