惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
Last Week in AI
Last Week in AI
月光博客
月光博客
D
DataBreaches.Net
WordPress大学
WordPress大学
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
U
Unit 42
Recent Announcements
Recent Announcements
宝玉的分享
宝玉的分享
MyScale Blog
MyScale Blog
C
Check Point Blog
F
Fortinet All Blogs
B
Blog
小众软件
小众软件
Vercel News
Vercel News
罗磊的独立博客
有赞技术团队
有赞技术团队

博客园 - Tachikoma

用Ruby实现 Web Service Server ,并用Ruby发送 HTTP请求 Web Service Android 使用 Ksoap2 出现的低级错误... - Tachikoma Cygwin中通过RJB在Ruby下调用ICTCLAS(JAVA) ICTCLAS4J 的编译脚本 Ruby Sandbox 实现运行客户代码 - Tachikoma Ruby在使用MongoDB时,对Cursor的重新包装 ruby 下使用 ICTCLAS(JAVA) RJB 在windows下的一些安装事项 Ruby手工测试正确,rcov测试失败的解决 在dell dimension 5150 上安装 leopard 手记 Rails测试中清空数据表/载入空fixtures RDoc 解决同名module 与 Class的问题 C 实用的 e-editor 的bundle Best of Ruby Quiz - Animal Quiz Best of Ruby Quiz - GEDCOM Parser Best of Ruby Quiz - MadLib - Tachikoma 使用selenium-on-rails的一些讨论 2]清理缓存 - Tachikoma - 博客园 使用selenium-on-rails的一些讨论 [0,1] 关于 rails ActiveRecord 属性 以及 foreign_key 不直接用数据库项目 时的一些讨论
使用selenium-on-rails的一些讨论 3]assertXpathCount的使用
Tachikoma · 2008-04-27 · via 博客园 - Tachikoma

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
 3def store_xpath_count locator, variable_name
 4  command 'storeXpathCount',locator, variable_name
 5end
 6
 7def 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  
14end

generate_methods中第11行为添加项
一切OK