我想使用watir-webdriver设置text_field的值。我想设置的值有开始和结束括号,ex“Boston(02116)”。我只能设置右括号的值,而不是开括号。尝试了各种不同的东西,但没有任何效果。我很感激任何解决此问题的建议。
HTML代码
<div id="search-container">
<div class="label">Search</div>
<div>
<form accept-charset="UTF-8" action="/search/js/update" method="get">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="✓">
</div>
<span role="status" aria-live="polite" class="ui-helper-hidden-accessible">1 result is available, use up and down arrow keys to navigate.
</span>
<input class="tab_header_filter search ui-autocomplete-input" id="search-list" name="project_name" type="text" value="" autocomplete="off">
</form>
</div>
<div class="clear"></div>
</div>
watir-webdriver代码
irb
require 'watir-webdriver'
b=Watir::Browser.new
b.text_field(:id => 'search-list').set "Boston (02116)"
b.text_field(:id => 'search-list').to_subtype.set "Boston (02116)"
b.input(:class => 'tab_header_filter search ui-autocomplete-input').to_subtype.value = "Boston (02116)"
b.div(:id =>'search-container').div(:index => 1).input(:index=>1).to_subtype.set "Boston (02116)"
我在文本字段中尝试了上述命令的几种变体,并且所有这些变体都插入了Boston 02116)。我不能在那里得到波士顿(02116)。有什么想法吗?