Forum: Ruby eruby Mechanize problem when submitting multiple forms

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8f266fb5632c9288fe3c14a94a805c70?d=identicon&s=25 unknown (Guest)
on 2007-04-05 18:06
(Received via mailing list)
Hi All,

I am using eruby and Mechanize to submit forms on a website. The first
has a "Accept Agreement" checkbox, when user checks this checkbox and
submits this form, another form shows up which is the actual input

When using eruby and Mechanize, I get the first form, check the accept
checkbox and then get the second form and then populate the fields in
second form. But when I submit the second form, it shows a page
saying  "You
did not accept the agreement on first form". So basically the Accept
first form is not getting passed while submitting the second form.

here is what I am doing:

agent =
page = agent.get("")
form = page.forms[1]         // get first form'accept').check    // accept agreement
page = agent.submit(form) // submit first form
nextform = page.forms[1]      //get next form
nextform.first_name = "myname"      // populate second form
nextform.last_name = "mylastname"
page = agent.submit(nextform) // submit second form
puts page.body

Does anyone know how can I get this to work ?
This topic is locked and can not be replied to.