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