硒:Selenium RC ruby驱动程序中的wait_for_ *和朋友 [英] Selenium: wait_for_* and friends in Selenium RC ruby driver
问题描述
是否有所有漂亮的 Selenium on Rails 方法的实现,例如,wait_for_visible
, assert_not_text_present
,...是 Selenium RC的红宝石驱动程序吗?
如果没有,我将如何实现类似wait_for_visible之类的东西?
我解决了自己的问题.
我在 Git Hub存储库中找到了官方的ruby客户 >
我编写了此解决方案,因此您只需require
此代码即可使用所有有用的wait_for_*, assert_*, assert_not_*, wait_for_not_*, verify_*, and verify_not_*
命令.
#need this for starts_with? and camelize
require 'activesupport'
module Selenium
module Client
class Driver
def method_missing(method, *args)
method_prefixes = %w(wait_for wait_for_not assert_ assert_not verify verify_not store)
method_name = method.to_s
prefix = method_prefixes.find {|pre| method_name.starts_with?(pre)}
#if the method starts with a prefix, camelize the name.
if(prefix)
string_command method_name.camelize(:lower), *args
else
super *args
end
end
end
end
end
Are there any implementations of all the nifty Selenium on Rails methods like wait_for_visible
, assert_not_text_present
, ... for the ruby driver of Selenium RC?
If not, how would I go about implementing something like wait_for_visible?
I solved my own problem.
I found the official ruby client at the Git Hub Repository
I wrote this solution so you can just require
this code then you can use all the useful wait_for_*, assert_*, assert_not_*, wait_for_not_*, verify_*, and verify_not_*
commands.
#need this for starts_with? and camelize
require 'activesupport'
module Selenium
module Client
class Driver
def method_missing(method, *args)
method_prefixes = %w(wait_for wait_for_not assert_ assert_not verify verify_not store)
method_name = method.to_s
prefix = method_prefixes.find {|pre| method_name.starts_with?(pre)}
#if the method starts with a prefix, camelize the name.
if(prefix)
string_command method_name.camelize(:lower), *args
else
super *args
end
end
end
end
end
这篇关于硒:Selenium RC ruby驱动程序中的wait_for_ *和朋友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!