Virginian
2008-Feb-29  07:12 UTC
mechanize problem with weird field names that contain colons such as "_ctl0:ContentPlaceHolder1:tbLastName"
Ruby is blowing up on me when I use fieldnames with colons such as
"_ctl0:ContentPlaceHolder1:tbLastName"
you can  irb session looks like: this which you can copy and paste to
try it as the site is on the web.
http://pastie.caboo.se/159184
require ''rubygems''
require ''mechanize''
agent = WWW::Mechanize.new
page =
agent.get(''https://www.sss.gov/RegVer/wfVerification.aspx'')
pp page
# from the output I see that the form name is  {name "aspnetForm"}
sss_form = page.form(''aspnetForm'')
pp sss_form
# I prints the form which I can see a few filed names including
# #<WWW::Mechanize::Form::Field:0x110f224 @name="InitialDay",
@value="29">
# and another one for this sample
#  #<WWW::Mechanize::Form::Field:0x110d348
@name="_ctl0:ContentPlaceHolder1:tbLastName", value="">
sss_form.InitialDay = "1"
# => "1"
sss_form._ctl0:ContentPlaceHolder1:tbLastName = ''Smith''
#SyntaxError: compile error
#(irb):14: syntax error, unexpected '':'', expecting $end
#sss_form._ctl0:ContentPlaceHolder1:tbLastName = ''Smith''
#                                   ^
#    from (irb):14
#    from :
#
#
# and so it blows up
Any ideas?
Thanks in advance for your help.
Best Regards - Charles
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---