Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Mechanize SelectList Issue

Reply
Thread Tools

Mechanize SelectList Issue

 
 
jwcooper
Guest
Posts: n/a
 
      03-20-2007
Hi,

I have been pretty successful in using Mechanize for submitting forms
of all types. The following select list has been giving me trouble to
no ends. I am not able to get it to submit for any reason. It
actually submits the form, but when I look at what I submitted, the
value is always blank.

Here is the select list:

<select style="font-family: Arial, sans-serif; font-size: 11px;"
name="Greetings" size="1">
<option value="">Please Select
<option>YO
<option>HELLO
<option>HOLA
</select>

One thing to note is that the <option>'s don't get closed (</
option>). Would this cause issues with Mechanize? When I "pp" the
page it seems list the three options with the correct text (although
it looks like this 'YO\n\t\t\t\t\t'), and with 'null' values.

Here is what I have tried to no avail:

form.fields.name('Greetings').options[1].click
form.fields.name('Greetings').options[1].select
form.field('Greetings').options[1].select
form.field('Greetings').options[1].click
form.fields('Greetings').options[1].click

I can successfully grab the values out of the options by using:

myselectlist = form.fields.name('Greetings').options[1]
puts myselectlist.text

Any ideas on why I can't submit the form with the option I want to
select? I can submit the form, but the 'select' never gets
processed. No errors are thrown.

Thank you for any help you can provide!

 
Reply With Quote
 
 
 
 
jwcooper
Guest
Posts: n/a
 
      03-21-2007
On Mar 20, 3:13 pm, "jwcooper" <(E-Mail Removed)> wrote:
> Hi,
>
> I have been pretty successful in using Mechanize for submitting forms
> of all types. The following select list has been giving me trouble to
> no ends. I am not able to get it to submit for any reason. It
> actually submits the form, but when I look at what I submitted, the
> value is always blank.
>
> Here is the select list:
>
> <select style="font-family: Arial, sans-serif; font-size: 11px;"
> name="Greetings" size="1">
> <option value="">Please Select
> <option>YO
> <option>HELLO
> <option>HOLA
> </select>
>
> One thing to note is that the <option>'s don't get closed (</
> option>). Would this cause issues with Mechanize? When I "pp" the
> page it seems list the three options with the correct text (although
> it looks like this 'YO\n\t\t\t\t\t'), and with 'null' values.
>
> Here is what I have tried to no avail:
>
> form.fields.name('Greetings').options[1].click
> form.fields.name('Greetings').options[1].select
> form.field('Greetings').options[1].select
> form.field('Greetings').options[1].click
> form.fields('Greetings').options[1].click
>
> I can successfully grab the values out of the options by using:
>
> myselectlist = form.fields.name('Greetings').options[1]
> puts myselectlist.text
>
> Any ideas on why I can't submit the form with the option I want to
> select? I can submit the form, but the 'select' never gets
> processed. No errors are thrown.
>
> Thank you for any help you can provide!


I am still a bit out of luck on this one. Anyone have any ideas?

I've also tried just setting the value of the select list to my
desired value, and that didn't work either.

Thank you!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
asp.net mvc SelectList help rodchar ASP .Net 4 09-30-2009 04:22 PM
Create SelectList shapper ASP .Net 5 09-08-2008 04:11 PM
popup after selection from selectlist Giel Raijmakers Ruby 0 01-04-2008 08:47 AM
possible issue with mechanize/python parsing bruce Python 0 07-10-2006 05:12 AM
How to keep the selectlist selected ????? Gianni Java 2 04-19-2004 07:01 AM



Advertisments