Class: TerminusSpec::WebObjects::WebObject
- Inherits:
-
Object
- Object
- TerminusSpec::WebObjects::WebObject
- Defined in:
- lib/terminus_spec/web_objects/all.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(web_object, platform) ⇒ WebObject
constructor
A new instance of WebObject.
-
#method_missing(*args, &block) ⇒ Object
Used to delegate calls to the driver object.
Constructor Details
#initialize(web_object, platform) ⇒ WebObject
Returns a new instance of WebObject.
6 7 8 9 |
# File 'lib/terminus_spec/web_objects/all.rb', line 6 def initialize(web_object, platform) @web_object = web_object mixin_web_objects_for platform end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
Used to delegate calls to the driver object.
45 46 47 48 49 50 51 52 |
# File 'lib/terminus_spec/web_objects/all.rb', line 45 def method_missing(*args, &block) m = args.shift begin @web_object.send m, *args, &block rescue Exception => e raise end end |
Class Method Details
.have_selenium_find_object_with(locator) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/terminus_spec/web_objects/all.rb', line 31 def self.have_selenium_find_object_with(locator) if locator.length == 1 #puts "****** What I got: #{locator}" object_locator = locator_for(locator, locators_for_selenium, mappings_for_selenium) #puts "****** What I gave: #{object_locator}" return object_locator.keys.first, object_locator.values.first elsif locator.length > 1 key = :xpath value = construct_xpath_for locator return key, value end end |
.have_watir_find_object_with(locator) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/terminus_spec/web_objects/all.rb', line 11 def self.have_watir_find_object_with(locator) if need_to_construct_watir_xpath(locator) key_path = :xpath value_path = construct_xpath_for(locator) return key_path => value_path end locator_list = {} locator.each do |key, value| current = {key => value} #puts "****** What I got: #{current}" object_locator = locator_for(current, locators_for_watir, mappings_for_watir) #puts "****** What I gave: #{object_locator}" locator_list[object_locator.keys.first] = object_locator.values.first end locator_list end |