Class: SpecTest::WebObjects::WebObject

Inherits:
Object
  • Object
show all
Defined in:
lib/spectest/web_objects/all.rb

Direct Known Subclasses

Button, Link, TextField

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(web_object, platform) ⇒ WebObject

Returns a new instance of WebObject.



5
6
7
8
# File 'lib/spectest/web_objects/all.rb', line 5

def initialize(web_object, platform)
  @web_object = web_object
  mixin_web_objects_for platform
end

Class Method Details

.have_selenium_find_object_with(locator) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/spectest/web_objects/all.rb', line 24

def self.have_selenium_find_object_with(locator)
  if locator.length == 1
    SpecTest::trace("What I got: #{locator}")
    object_locator = locator_for(locator, locators_for_selenium, mappings_for_selenium)
    SpecTest::trace("What I gave: #{object_locator}")
    return object_locator.keys.first, object_locator.values.first
  end
end

.have_watir_find_object_with(locator) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/spectest/web_objects/all.rb', line 10

def self.have_watir_find_object_with(locator)
  locator_list = {}

  locator.each do |key, value|
    current = {key => value}
    SpecTest::trace("What I got: #{current}")
    object_locator = locator_for(current, locators_for_watir, mappings_for_watir)
    SpecTest::trace("What I gave: #{object_locator}")
    locator_list[object_locator.keys.first] = object_locator.values.first
  end

  locator_list
end