Class: HTMLGeneric

Inherits:
Object
  • Object
show all
Includes:
Actions, Checks
Defined in:
lib/html_objects.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Checks

#verify_element_checked, #verify_element_inner_html, #verify_element_inner_text, #verify_element_not_checked, #verify_element_not_present, #verify_element_present, #verify_element_source, #verify_element_value

Methods included from Actions

#click, #fire_event, #set_multiple_options, #set_text, #set_text_value, #simulate_key_press, #submit_form

Constructor Details

#initialize(element, parameter, event, reporter) ⇒ HTMLGeneric

Returns a new instance of HTMLGeneric.



8
9
10
11
12
13
14
15
16
# File 'lib/html_objects.rb', line 8

def initialize(element,parameter,event,reporter)
  @element = element
  @event = event
  @locator_type = parameter.locator_type
  @locator_value = parameter.locator_value
  @value = parameter.value
  @parameter = parameter
  @reporter = reporter
end

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



3
4
5
# File 'lib/html_objects.rb', line 3

def element
  @element
end

#eventObject (readonly)

Returns the value of attribute event.



3
4
5
# File 'lib/html_objects.rb', line 3

def event
  @event
end

Instance Method Details

#actual_value(&block) ⇒ Object



41
42
43
44
45
# File 'lib/html_objects.rb', line 41

def actual_value(&block)
  value = yield self
  name = this_block_name
  assign name,value
end

#execute(method, &block) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/html_objects.rb', line 18

def execute(method,&block)
  begin
    yield
  rescue WIN32OLERuntimeError => e
    puts "\n[ERROR] You probably called method #{method} on an win32ole object that doesnt support it:"
    puts "locator_type    : #{@locator_type}"
    puts "locator_value   : #{@locator_value}"
    puts "parameter_value : #{@value}"
    puts "\nCaller stack:\n"
    puts caller
    puts "\nException stack:\n"
    puts e
  rescue => e
    raise UnexpectedError, "Something unexpected happened calling #{method}: \n\n#{caller}, \n\n#{e}"
  end
end

#expected_value(&block) ⇒ Object



35
36
37
38
39
# File 'lib/html_objects.rb', line 35

def expected_value(&block)
  value = yield self
  name = this_block_name
  assign name,value
end

#result(&block) ⇒ Object



47
48
49
50
51
# File 'lib/html_objects.rb', line 47

def result(&block)
  value = yield self
  name = this_block_name
  assign name,value
end