Class: NullDriver

Inherits:
Object
  • Object
show all
Defined in:
lib/rutl/driver/null_driver.rb

Overview

This is at a peer level to the webdrivers but it’s for a fake brwoser.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ NullDriver

Returns a new instance of NullDriver.



9
10
11
12
# File 'lib/rutl/driver/null_driver.rb', line 9

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

Instance Attribute Details

#contextObject

Returns the value of attribute context.



7
8
9
# File 'lib/rutl/driver/null_driver.rb', line 7

def context
  @context
end

Instance Method Details

#find_element(type, location) ⇒ Object



14
15
16
17
18
19
# File 'lib/rutl/driver/null_driver.rb', line 14

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 ????



23
24
25
26
# File 'lib/rutl/driver/null_driver.rb', line 23

def navigate
  context = ElementContext.new(interface: @context.interface)
  NullDriver.new(context)
end

#quitObject



34
35
36
37
# File 'lib/rutl/driver/null_driver.rb', line 34

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

#to(url) ⇒ Object



28
29
30
31
32
# File 'lib/rutl/driver/null_driver.rb', line 28

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