硒:wait_for_*和朋友在硒RC驾驶的红宝石
-
03-07-2019 - |
题
是否有任何实现所有的漂亮 硒在轨道上 方法一样 wait_for_visible
, assert_not_text_present
,...的 红宝石司机的硒RC?
如果不是,我怎么会去实现的东西喜欢wait_for_visible?
解决方案
我解决我自己的问题。
我找到了官方的宝石的客户 Git集线器库
我写了这个方案,所以你可以 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
不隶属于 StackOverflow