Module: EPO::PageObject

Defined in:
lib/epo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *param, &blk) ⇒ Object

make_timestamp



27
28
29
30
31
32
33
34
35
36
# File 'lib/epo.rb', line 27

def method_missing m, *param, &blk
  if VERY_SIMPLE_DSL.any? {|dsl| m.match Regexp.new(dsl)}
    if m[m.length - 1] == 's'
      return @dr.find_elements *param
    else
      return @dr.find_element *param
    end #if

  end #if

  @dr.send(m, *param, &blk) if @dr.respond_to?(m)
end

Instance Attribute Details

#drObject (readonly)

Returns the value of attribute dr.



5
6
7
# File 'lib/epo.rb', line 5

def dr
  @dr
end

#ui_methodsObject (readonly)

Returns the value of attribute ui_methods.



5
6
7
# File 'lib/epo.rb', line 5

def ui_methods
  @ui_methods
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/epo.rb', line 5

def url
  @url
end

Instance Method Details

#initialize(dr, domain) ⇒ Object



6
7
8
9
# File 'lib/epo.rb', line 6

def initialize dr, domain
  valid_driver? dr
  @dr, @domain = dr, domain 
end

#make_timestampObject

navigate_to



23
24
25
# File 'lib/epo.rb', line 23

def make_timestamp
  "?#{Time.now.to_f.to_s}"
end


15
16
17
18
19
20
21
# File 'lib/epo.rb', line 15

def navigate_to path = '', timestamp=false
  if timestamp
    @dr.get(@domain + path + make_timestamp)
  else
    @dr.get(@domain + path)
  end #if

end

#valid_driver?(dr) ⇒ Boolean

initialize

Returns:

  • (Boolean)

Raises:



11
12
13
# File 'lib/epo.rb', line 11

def valid_driver? dr
  raise NotValidDriverError unless dr.is_a?(Selenium::WebDriver::Driver)
end