Class: Zander::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/zander/action.rb

Instance Method Summary collapse

Constructor Details

#initialize(site, driver, log, hash) ⇒ Action

Returns a new instance of Action.



4
5
6
7
8
9
10
11
12
13
# File 'lib/zander/action.rb', line 4

def initialize(site, driver, log, hash)
	@site = site
	@log = log
	@driver = driver
	@private_variable = false
	parse_before_action(hash)
	parse_action_type(hash)
	parse_after_action(hash)
	@log.debug("Created #{self.class.name} #{self}")
end

Instance Method Details

#driveObject



75
76
77
78
79
# File 'lib/zander/action.rb', line 75

def drive
	element = get_element
	do_action(element)
	sleep(1)
end

#inspectObject



211
212
213
# File 'lib/zander/action.rb', line 211

def inspect
	to_s
end

#parse_type(hash) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/zander/action.rb', line 38

def parse_type(hash)
	case @action_type
	when 'click_element','print_element','switch_to_iframe'
		set_identifier(hash)
	when 'input_variable'
	 	set_identifier(hash)
	 	set_variable(hash)
	when 'input_data'
	 	set_identifier(hash)
	 	set_data(hash)
	when 'done','switch_to_new_window'
	else
	  @log.error("#{__method__} can't handle action_type #{@action_type} for #{self}")
	end
end