使用selenium-on-rails的一些讨论 3]assertXpathCount的使用

3.assertXpathCount的使用

xpath_count一族的函数
assertXpathCount
storeXpathCount
...

会发现在selenium-on-rails中并没有对应函数assert_xpath_count等
原因是selenium-on-rails所用的selenium-core好像版本不够...没有assert_xpath_count

首先需要更新selenium-core,下载最新的,把core文件夹下的东西全部覆盖到selenium-core就可以

然后需要添加函数
分析doc,发现selenium-on-rails所有断言函数的原型是store_*,由此生成一族函数
For each store_foo there‘s assert_foo, assert_not_foo, verify_foo, verify_not_foo, wait_for_foo, wait_for_not_foo.
做出如下修改
 1 #selenium - on - rails / lib / selenium - on - rails / test_builder_accessors.rb
 2
 3 def store_xpath_count locator, variable_name
 4   command  ' storeXpathCount ' ,locator, variable_name
 5 end
 6
 7 def self.generate_methods
 8   
 9    ' store_whether_this_frame_match_frame_expression ' ,
10    ' store_whether_this_window_match_window_expression ' ,
11    ' store_xpath_count '   ## tachikoma added
12   each_assertion method  do   | assertion_method, command_name |
13   
14 end
generate_methods中第11行为添加项
一切OK

转载于:https://www.cnblogs.com/Tachikoma/archive/2008/04/27/1172828.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值