class RUTL::Element::Element
View
element base class.
Attributes
context[RW]
Public Class Methods
new(element_context)
click to toggle source
# File lib/rutl/element/element.rb, line 9 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 application'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 = $application.interface end
Public Instance Methods
exists?()
click to toggle source
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.
# File lib/rutl/element/element.rb, line 31 def exists? find_element rescue Selenium::WebDriver::Error::NoSuchElementError false end
find_element()
click to toggle source
# File lib/rutl/element/element.rb, line 23 def find_element @context.find_element end
method_missing(method, *args, &block)
click to toggle source
# File lib/rutl/element/element.rb, line 37 def method_missing(method, *args, &block) if args.empty? find_element.send(method) else find_element.send(method, *args, &block) end end
respond_to_missing?(*args)
click to toggle source
# File lib/rutl/element/element.rb, line 45 def respond_to_missing?(*args) find_element.respond_to?(*args) end