Class: NullDriver
- Inherits:
-
Object
- Object
- NullDriver
- 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
-
#context ⇒ Object
Returns the value of attribute context.
Instance Method Summary collapse
- #find_element(type, location) ⇒ Object
-
#initialize(context) ⇒ NullDriver
constructor
A new instance of NullDriver.
-
#navigate ⇒ Object
Cheap way to handle browser.navigate.to(url) TODO: Until I care about the url and then I should ????.
- #quit ⇒ Object
- #to(url) ⇒ Object
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
#context ⇒ Object
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 |
#navigate ⇒ Object
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 |
#quit ⇒ Object
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 |