2012年12月20日

[笔记]--BDD测试使用Capybara遇到的问题及解决方法

摘要: 一、有多个相同的元素Capybara报错:Ambiguous match, found 4 elements matching button "下一步",由于有些元素没有ID属性所以可以用Xpathfind(:xpath, "//html/body/div/div[2]/div[2]/div[2]/button[2]").click 或者选择第1个时可以这样写first(:button, '下一步>').click 但second(:button, '下一步>').click 就不行。参考:http://sta 阅读全文

posted @ 2012-12-20 16:20 Wilask 阅读(250) 评论(0) 推荐(0)

[笔记]--Capybara API学习整理(Ambiguous match, found N elements matching xpath)

摘要: Capybara 2.0 web_steps.rb file to avoid "Ambiguous match, found N elements matching xpath" (Capybara::Ambiguous)# TL;DR: YOU SHOULD DELETE THIS FILE## This file was generated by Cucumber-Rails and is only here to get you a head start# These step definitions are thin wrappers around the Cap 阅读全文

posted @ 2012-12-20 14:18 Wilask 阅读(486) 评论(0) 推荐(0)

[笔记]--Capybara API学习整理

摘要: Capybara APICapybara提供了许多API对网页元素进行操作,如果使用Cucumber做BDD那么要在env.rb文件中加入语句:require 'cucumber/formatter/unicode' #在Windows下可以显示中文require 'rubygems'require 'capybara'require 'capybara/cucumber'require 'capybara/dsl' #When using capybara/dsl, the Session is initiali 阅读全文

posted @ 2012-12-20 13:38 Wilask 阅读(644) 评论(0) 推荐(0)

导航