Mechanize complex form input name

I am trying to access a form in mechanization with ugly characters in the object name similar to this

agent = Mechanize.new
page  = agent.get('http://domain.com)
form = page.forms[0]
form.ct600$Main$LastNameTextBox = "whatever"
page  = agent.submit(form)

      

The problem is that the $ in the html name is messing with ruby.
Is there any other way I could use, for example:

form.element_by_name("ct600$Main$LastNameTextBox") = "whatever"

      

Unfortunately I cannot change the html

+2


a source to share


1 answer


I've never touched Ruby, but according to the docs (you read the docs, right?),

form["ct600$Main$LastNameTextBox"] = "whatever"

      



must work.

+4


a source







All Articles