Reputation: 3903
I am trying to access a form in mechanize 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 the $ in the html name is messing with ruby.
Is there another method i could use ie:
form.element_by_name("ct600$Main$LastNameTextBox") = "whatever"
Unfortunately i cant change the html
Upvotes: 2
Views: 1422
Reputation: 65116
I've never touched Ruby, but according to the docs (you did read the docs, right?),
form["ct600$Main$LastNameTextBox"] = "whatever"
should work.
Upvotes: 4