机械化 - 在输入名称中用方括号填写表格
Mechanize - Fill form with square brackets in input name
我正在尝试使用 Mechanize 填写表格。它有效,但一些输入名称内部有 [],但它失败了。
<input id="titleen_US" type="text" name="title[en_US]" value="">
我试过了
a = Mechanize.new
page = a.get("http://myurl.com")
first_form = page.form('item')
first_form.title[en_US] = 'This is my title'
但是我有undefined method 'title='
。
任何的想法?谢谢
尝试关注。
a = Mechanize.new
page = a.get("http://myurl.com")
first_form = page.form('item')
title_field = first_form.field_with(:name => "title[en_US]")
title_field.value = "whatever_title"
或
a = Mechanize.new
page = a.get("http://myurl.com")
first_form = page.form('item')
first_form['title[en_US]'] = "title"
我正在尝试使用 Mechanize 填写表格。它有效,但一些输入名称内部有 [],但它失败了。
<input id="titleen_US" type="text" name="title[en_US]" value="">
我试过了
a = Mechanize.new
page = a.get("http://myurl.com")
first_form = page.form('item')
first_form.title[en_US] = 'This is my title'
但是我有undefined method 'title='
。
任何的想法?谢谢
尝试关注。
a = Mechanize.new
page = a.get("http://myurl.com")
first_form = page.form('item')
title_field = first_form.field_with(:name => "title[en_US]")
title_field.value = "whatever_title"
或
a = Mechanize.new
page = a.get("http://myurl.com")
first_form = page.form('item')
first_form['title[en_US]'] = "title"