From richvote at gmail.com Thu Dec 16 17:41:02 2010 From: richvote at gmail.com (=?iso-2022-jp?B?GyRCPzxDKxsoQiAbJEJLJ09CGyhC?=) Date: Fri, 17 Dec 2010 07:41:02 +0900 Subject: [Mechanize-users] ruby1.9.2 Message-ID: <68686D19-C2D4-4814-B0B6-F549BCC319C6@gmail.com> Can mechanize work with ruby1.9.2? iPhone???? From mattw922 at gmail.com Thu Dec 16 20:54:46 2010 From: mattw922 at gmail.com (Matt White) Date: Thu, 16 Dec 2010 18:54:46 -0700 Subject: [Mechanize-users] ruby1.9.2 In-Reply-To: <68686D19-C2D4-4814-B0B6-F549BCC319C6@gmail.com> References: <68686D19-C2D4-4814-B0B6-F549BCC319C6@gmail.com> Message-ID: <15F74C4C-335A-44C8-8A85-7FED359983C2@gmail.com> I've used it with 1.9.2. Are you having a specific problem? On Dec 16, 2010, at 3:41 PM, ?? ?? wrote: > Can mechanize work with ruby1.9.2? > > iPhone???? > _______________________________________________ > Mechanize-users mailing list > Mechanize-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mechanize-users From cschaller at gmail.com Wed Dec 22 22:13:07 2010 From: cschaller at gmail.com (Cindy Schaller) Date: Wed, 22 Dec 2010 21:13:07 -0600 Subject: [Mechanize-users] Multi-Step forms with Mechanize Message-ID: <000301cba24f$5343cee0$f9cb6ca0$@gmail.com> Hi, I need to fill out a multi-page form using Mechanize and am trying to figure out how to step through the pages to get back the final results. I've tried a few different variations, but can't get any of them to work. This is the most recent variation. The first submit works well, but then I am unable to figure out how to access and submit the form on the following page. Any help is greatly appreciated!!!! agent.get(data) do |data| data.form('Page1') do |data_type| data_type.field("A").option_with(:value => '1').select # pp data_type # this verifies that the select option is selected end.submit # ??? The previous submit presents me with another form and I need to select more variables and hit submit again. end Thanks, Cindy -------------- next part -------------- An HTML attachment was scrubbed... URL: From benmanns at gmail.com Thu Dec 23 00:30:10 2010 From: benmanns at gmail.com (Benjamin Manns) Date: Thu, 23 Dec 2010 00:30:10 -0500 Subject: [Mechanize-users] Multi-Step forms with Mechanize In-Reply-To: <000301cba24f$5343cee0$f9cb6ca0$@gmail.com> References: <000301cba24f$5343cee0$f9cb6ca0$@gmail.com> Message-ID: Cindy, You should be able to pass the returned page from the form into a variable and manipulate that: agent.get(data) do |data| next_form = data.form('Page1') do |data_type| data_type.field("A").option_with(:value => '1').select end.submit next_form.form('Page2') ... end -- Benjamin Manns benmanns at gmail.com (434) 321-8324 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cschaller at gmail.com Thu Dec 23 01:03:10 2010 From: cschaller at gmail.com (Cindy Schaller) Date: Thu, 23 Dec 2010 00:03:10 -0600 Subject: [Mechanize-users] Multi-Step forms with Mechanize In-Reply-To: References: <000301cba24f$5343cee0$f9cb6ca0$@gmail.com> Message-ID: Hi, thanks so much for your reply. I did something like that at one point in my experimentation, but got stuck on how to submit the next form? This is where it broke down for me. And do I need to do another call to agent.get with subsequent pages? Thanks! Cindy On Dec 22, 2010 11:56 PM, "Benjamin Manns" wrote: > Cindy, > > You should be able to pass the returned page from the form into a variable > and manipulate that: > > > agent.get(data) do |data| > > next_form = data.form('Page1') do |data_type| > > data_type.field("A").option_with(:value => '1').select > end.submit > > next_form.form('Page2') ... > end > > -- > Benjamin Manns > benmanns at gmail.com > (434) 321-8324 -------------- next part -------------- An HTML attachment was scrubbed... URL: From benmanns at gmail.com Thu Dec 23 12:58:07 2010 From: benmanns at gmail.com (Benjamin Manns) Date: Thu, 23 Dec 2010 12:58:07 -0500 Subject: [Mechanize-users] Multi-Step forms with Mechanize In-Reply-To: References: <000301cba24f$5343cee0$f9cb6ca0$@gmail.com> Message-ID: Cindy, Ah, to chain them all together: agent.get(data) do |data| next_form = data.form('Page1') do |data_type| data_type.field("A").option_with(:value => '1').select end.submit third_form = next_form.form('Page2') do |data_type| data_type.field("B").option_with(:value => '2').select end.submit fourth_form = third_form.form('Page3') do |data_type| data_type.field("C").option_with(:value => '3').select end.submit final_page = fourth_form.form('Page4') do |data_type| data_type.field("D").option_with(:value => '4').select end.submit # from here on you can use final_page.methods (links, images, forms, ...) end Each call to submit, get, etc. returns a Mechanize::Page, which comes with all kinds of cool methods. You can read the documentation on all of them here: http://mechanize.rubyforge.org/mechanize/Mechanize/Page.html. Ben -- Benjamin Manns benmanns at gmail.com (434) 321-8324 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cschaller at gmail.com Thu Dec 23 16:23:26 2010 From: cschaller at gmail.com (Cindy Schaller) Date: Thu, 23 Dec 2010 15:23:26 -0600 Subject: [Mechanize-users] Multi-Step forms with Mechanize In-Reply-To: References: <000301cba24f$5343cee0$f9cb6ca0$@gmail.com> Message-ID: <00f301cba2e7$a3964330$eac2c990$@gmail.com> Thanks for your help. I was really close. It's working great now. Cindy From: mechanize-users-bounces at rubyforge.org [mailto:mechanize-users-bounces at rubyforge.org] On Behalf Of Benjamin Manns Sent: Thursday, December 23, 2010 11:58 AM To: Ruby Mechanize Users List Subject: Re: [Mechanize-users] Multi-Step forms with Mechanize Cindy, Ah, to chain them all together: agent.get(data) do |data| next_form = data.form('Page1') do |data_type| data_type.field("A").option_with(:value => '1').select end.submit third_form = next_form.form('Page2') do |data_type| data_type.field("B").option_with(:value => '2').select end.submit fourth_form = third_form.form('Page3') do |data_type| data_type.field("C").option_with(:value => '3').select end.submit final_page = fourth_form.form('Page4') do |data_type| data_type.field("D").option_with(:value => '4').select end.submit # from here on you can use final_page.methods (links, images, forms, ...) end Each call to submit, get, etc. returns a Mechanize::Page, which comes with all kinds of cool methods. You can read the documentation on all of them here: http://mechanize.rubyforge.org/mechanize/Mechanize/Page.html. Ben -- Benjamin Manns benmanns at gmail.com (434) 321-8324 -------------- next part -------------- An HTML attachment was scrubbed... URL: