Sha256: a516941ab49b72c12181aa0a85e468bbdb5ca93695e6dd521c45afcd509f7ead
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
module RUTL module Element # # Page element base class. # class Element attr_accessor :context def initialize(element_context) raise element_context.to_s unless element_context.is_a? ElementContext @context = element_context # Not sure why, but I'm seeing Chrome fail becase the context interface # passed in isn't the same as the browser's interface. # This only happens with click test cases, before the click, and # only if that case isn't run first. # The context we're passed is also an instance from as # RUTL::Interface::Chrome, but a different instance. # # Here's the kludge workaround line: @context.interface = $browser.interface end # Returns the element at this css selector. def this_css @context.find_element(:css) end # Returns boolean, of course. # Unlike the underlying Selenium library, I have .exists? because I may # have a valid Element object for something that doesn't exist. Anymore. # Or yet. def exists? this_css rescue Selenium::WebDriver::Error::NoSuchElementError false end def method_missing(method, *args, &block) if args.empty? this_css.send(method) else this_css.send(method, *args, &block) end end def respond_to_missing?(*args) this_css.respond_to?(*args) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rutl-0.6.0 | lib/rutl/element/element.rb |