|
我也是名watir初学者,测试的网站是C#编写的
1.关于combox的问题
在编写下拉框时,下拉框的类型是combobox
网站的源文件是:
<select xtype="combo" ext_errIcoOffset="0" ext_height="18px" ext_selectOnFocus="true" ext_forceSelection="true" ext_mode="local" ext_displayField="Text" ext_valueField="Value" ext_maxHeight="300" ext_listWidth="-1" name="ctl00$ContentPlaceHolderBody$ComboBoxStoreName" onchange="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolderBody$ComboBoxStoreName\',\'\')', 0)" id="ctl00_ContentPlaceHolderBody_ComboBoxStoreName" style="height:18px;">
<option value="-1">--Please choose--</option>
<option value="120">changsha one</option>
<option selected="selected" value="131">Alberta</option>
</select>
我编写的是:
ie.select_list(:name,'ctl00$ContentPlaceHolderBody$ComboBoxStoreName').set("changsha one")
运行后,总是
underfined method 'set' for #<watir::selectlist:0x2e35164>(Nomethoderror)
后来换成了
ie.select_list(:name, 'ctl00$ContentPlaceHolderBody$ComboBoxStoreName').select_value('changsha one')
运行后,提示找不到select_value这个方法
以为是版本太低了,我装的是watir1.4,不支持这个方法,
2.安装问题
后来按照网上的装了watir-1.6.2.gem,结果连运行都不行,总是提示
C:/Ruby/lib/ruby/gems/1.8/gems/windows-pr-0.9.3/lib/windows/thread.rb:59: uninitialized constant Windows::API::Error (NameError)
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/Ruby/lib/ruby/gems/1.8/gems/win32-process-0.5.9/lib/win32/process.rb:3
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-process.rb:1
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie.rb:45
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from google.rb:2
网上说是
require 'watir'--->require 'watir/ie'
还是运行报错
麻烦熟悉watir的高手帮帮小妹!在此感激不尽! |
|