Sha256: 0da3f65a116d81aec6fd5a8e6f0ea5d47bb47b861ac0167a2ca5fe04704bee27

Contents?: true

Size: 1021 Bytes

Versions: 4

Compression:

Stored size: 1021 Bytes

Contents

require 'rutl/driver/null_driver_page_element'

#
# This is at a peer level to the webdrivers but it's for a fake brwoser.
#
class NullDriver
  attr_accessor :context

  def initialize(context)
    raise 'no context' unless context.is_a?(ElementContext)
    @context = context
  end

  def find_element(type, location)
    # Return a new one of these so that it can be clicked ar written
    # to or whatever.
    context = ElementContext.new(interface: @context.interface)
    NullDriverPageElement.new(context, type, location)
  end

  # Cheap way to handle browser.navigate.to(url)
  # TODO: Until I care about the url and then I should ????
  def navigate
    context = ElementContext.new(interface: @context.interface)
    NullDriver.new(context)
  end

  def to(url)
    result = @context.interface.find_page(url)
    @context.interface.current_page = result
    result.url
  end

  def quit
    # Clean out the @@variables.
    NullDriverPageElement.clear_variables
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rutl-0.3.0 lib/rutl/driver/null_driver.rb
rutl-0.2.1 lib/rutl/driver/null_driver.rb
rutl-0.2.0 lib/rutl/driver/null_driver.rb
rutl-0.1.4 lib/rutl/driver/null_driver.rb