Class: RIESS::ElementFinder
- Inherits:
-
Object
- Object
- RIESS::ElementFinder
- Defined in:
- lib/finders.rb
Constant Summary collapse
- READYSTATE_UNINITIALIZED =
0
- READYSTATE_LOADING =
1
- READYSTATE_LOADED =
2
- READYSTATE_INTERACTIVE =
3
- READYSTATE_COMPLETE =
4
Instance Method Summary collapse
- #find_element ⇒ Object
- #find_element_by_id ⇒ Object
- #find_element_by_name ⇒ Object
- #find_element_by_search ⇒ Object
- #find_element_by_search_path ⇒ Object
-
#initialize(ie_object, parameter) ⇒ ElementFinder
constructor
A new instance of ElementFinder.
- #wait_for_page_load ⇒ Object
Constructor Details
#initialize(ie_object, parameter) ⇒ ElementFinder
Returns a new instance of ElementFinder.
29 30 31 32 33 |
# File 'lib/finders.rb', line 29 def initialize(ie_object,parameter) @ie_object = ie_object @locator_type = parameter.locator_type @locator_value = parameter.locator_value end |
Instance Method Details
#find_element ⇒ Object
35 36 37 38 |
# File 'lib/finders.rb', line 35 def find_element wait_for_page_load send(LocatorStrategy.new.locator[@locator_type]) end |
#find_element_by_id ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/finders.rb', line 46 def find_element_by_id if has_frames? find_element_in_frames('id') else finder = @ie_object.find_by_id(@locator_value) end end |
#find_element_by_name ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/finders.rb', line 54 def find_element_by_name if has_frames? find_element_in_frames('name') else finder = @ie_object.find_by_name(@locator_value) end end |
#find_element_by_search ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/finders.rb', line 62 def find_element_by_search if has_frames? find_element_in_frames('search') else finder = @ie_object.search(@locator_value).first end end |
#find_element_by_search_path ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/finders.rb', line 70 def find_element_by_search_path if has_frames? find_search_by_frames else finder = @ie_object.search_path(@locator_value).first end end |
#wait_for_page_load ⇒ Object
40 41 42 43 44 |
# File 'lib/finders.rb', line 40 def wait_for_page_load while @ie_object.readyState < READYSTATE_COMPLETE || @ie_object.Busy || @ie_object.document.readyState != "complete" sleep 0.01 end end |