셀레늄 : Wait_for_* 및 셀레늄 RC 루비 드라이버의 친구
-
03-07-2019 - |
문제
모든 Nifty의 구현이 있습니까? 레일에 셀레늄 와 같은 방법 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