Module: Decoy::Commands

Defined in:
lib/decoy/commands.rb

Instance Method Summary collapse

Instance Method Details

#activate(opts = {}) ⇒ Object



7
8
9
# File 'lib/decoy/commands.rb', line 7

def activate(opts={}) #[]
  app.activate opts
end

#appObject



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

def app
  @app ||= Decoy.app
end

#assert(opts = {}) ⇒ Object

“HTTP_status_code_equals”, “HTTP_status_code_is_not_equal”, “JavaScript_evaluates_true”, “XPath_evaluates_true”, “does_not_have_JavaScript_dialog_with_text”, “has_JavaScript_dialog_with_text”, “in”, “page_contains_text”, “page_does_not_contain_text”, “page_does_not_have_element_for_XPath”, “page_does_not_have_element_with_id”, “page_does_not_have_element_with_name”, “page_has_element_for_XPath”, “page_has_element_with_id”, “page_has_element_with_name”, “page_title_equals”, “page_title_is_not_equal”


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

def assert(opts={}) #["HTTP_status_code_equals", "HTTP_status_code_is_not_equal", "JavaScript_evaluates_true", "XPath_evaluates_true", "does_not_have_JavaScript_dialog_with_text", "has_JavaScript_dialog_with_text", "in", "page_contains_text", "page_does_not_contain_text", "page_does_not_have_element_for_XPath", "page_does_not_have_element_with_id", "page_does_not_have_element_with_name", "page_has_element_for_XPath", "page_has_element_with_id", "page_has_element_with_name", "page_title_equals", "page_title_is_not_equal"]
  app.assert opts
end

#capture_web_page(opts = {}) ⇒ Object

“as”, “in”, “saving_in”


15
16
17
# File 'lib/decoy/commands.rb', line 15

def capture_web_page(opts={}) #["as", "in", "saving_in"]
  app.capture_web_page opts
end

#click_element(opts = {}) ⇒ Object

“for_CSS_selector”, “for_JavaScript”, “for_XPath”, “in”, “with_id”, “with_name”, “with_text”


19
20
21
# File 'lib/decoy/commands.rb', line 19

def click_element(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "with_id", "with_name", "with_text"]
  app.click_element opts
end
“for_CSS_selector”, “for_JavaScript”, “for_XPath”, “in”, “opening_in_background”, “opening_in_new_tab”, “with_id”, “with_name”, “with_text”


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

def click_link(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "opening_in_background", "opening_in_new_tab", "with_id", "with_name", "with_text"]
  app.click_link opts
end

#close(opts = {}) ⇒ Object

“saving”, “saving_in”


27
28
29
# File 'lib/decoy/commands.rb', line 27

def close(opts={}) #["saving", "saving_in"]
  app.close app.document, opts
end

#count(opts = {}) ⇒ Object



31
32
33
# File 'lib/decoy/commands.rb', line 31

def count(opts={}) #[]
  app.count opts
end

#delete(opts = {}) ⇒ Object



35
36
37
# File 'lib/decoy/commands.rb', line 35

def delete(opts={}) #[]
  app.delete opts
end

#dismiss_javascript_dialog(opts = {}) ⇒ Object

“in”, “with_button”


39
40
41
# File 'lib/decoy/commands.rb', line 39

def dismiss_javascript_dialog(opts={}) #["in", "with_button"]
  app.dismiss_JavaScript_dialog app.document, opts
end

#dispatch_keyboard_event(opts = {}) ⇒ Object

“charCode”, “command_key_pressed”, “control_key_pressed”, “in”, “keyCode”, “option_key_pressed”, “shift_key_pressed”, “to_element_for_CSS_selector”, “to_element_for_JavaScript”, “to_element_for_XPath”, “to_element_with_id”, “to_element_with_name”, “with_type”


43
44
45
# File 'lib/decoy/commands.rb', line 43

def dispatch_keyboard_event(opts={}) #["charCode", "command_key_pressed", "control_key_pressed", "in", "keyCode", "option_key_pressed", "shift_key_pressed", "to_element_for_CSS_selector", "to_element_for_JavaScript", "to_element_for_XPath", "to_element_with_id", "to_element_with_name", "with_type"]
  app.dispatch_keyboard_event opts
end

#dispatch_mouse_event(opts = {}) ⇒ Object

“button”, “click_count”, “command_key_pressed”, “control_key_pressed”, “in”, “option_key_pressed”, “related_target_for_CSS_selector”, “related_target_for_JavaScript”, “related_target_for_XPath”, “related_target_with_id”, “related_target_with_name”, “shift_key_pressed”, “to_element_for_CSS_selector”, “to_element_for_JavaScript”, “to_element_for_XPath”, “to_element_with_id”, “to_element_with_name”, “with_type”


47
48
49
# File 'lib/decoy/commands.rb', line 47

def dispatch_mouse_event(opts={}) #["button", "click_count", "command_key_pressed", "control_key_pressed", "in", "option_key_pressed", "related_target_for_CSS_selector", "related_target_for_JavaScript", "related_target_for_XPath", "related_target_with_id", "related_target_with_name", "shift_key_pressed", "to_element_for_CSS_selector", "to_element_for_JavaScript", "to_element_for_XPath", "to_element_with_id", "to_element_with_name", "with_type"]
  app.dispatch_mouse_event opts
end

#do_javascript(opts = {}) ⇒ Object

“in”


51
52
53
# File 'lib/decoy/commands.rb', line 51

def do_javascript(opts={}) #["in"]
  app.do_JavaScript app.document, opts
end

#duplicate(opts = {}) ⇒ Object

“to”, “with_properties”


55
56
57
# File 'lib/decoy/commands.rb', line 55

def duplicate(opts={}) #["to", "with_properties"]
  app.duplicate opts
end

#empty_cache(opts = {}) ⇒ Object



59
60
61
# File 'lib/decoy/commands.rb', line 59

def empty_cache(opts={}) #[]
  app.empty_cache opts
end

#exists(opts = {}) ⇒ Object



63
64
65
# File 'lib/decoy/commands.rb', line 63

def exists(opts={}) #[]
  app.exists opts
end

#focus_element(opts = {}) ⇒ Object

“for_CSS_selector”, “for_JavaScript”, “for_XPath”, “in”, “in_form_for_CSS_selector”, “in_form_for_JavaScript”, “in_form_for_XPath”, “in_form_with_id”, “in_form_with_name”, “to”, “with_id”, “with_name”


67
68
69
# File 'lib/decoy/commands.rb', line 67

def focus_element(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "in_form_for_CSS_selector", "in_form_for_JavaScript", "in_form_for_XPath", "in_form_with_id", "in_form_with_name", "to", "with_id", "with_name"]
  app.focus_element opts
end

#get(opts = {}) ⇒ Object



71
72
73
# File 'lib/decoy/commands.rb', line 71

def get(opts={}) #[]
  app.get opts
end

#go_back(opts = {}) ⇒ Object



75
76
77
# File 'lib/decoy/commands.rb', line 75

def go_back(opts={}) #[]
  app.go_back opts
end

#go_forward(opts = {}) ⇒ Object



79
80
81
# File 'lib/decoy/commands.rb', line 79

def go_forward(opts={}) #[]
  app.go_forward opts
end

#go_home(opts = {}) ⇒ Object



83
84
85
# File 'lib/decoy/commands.rb', line 83

def go_home(opts={}) #[]
  app.go_home opts
end

#launch(opts = {}) ⇒ Object



87
88
89
# File 'lib/decoy/commands.rb', line 87

def launch(opts={}) #[]
  app.launch opts
end

#load_url(opts = {}) ⇒ Object

“in”


91
92
93
# File 'lib/decoy/commands.rb', line 91

def load_url(opts={}) #["in"]
  app.load_URL opts
end

#make(opts = {}) ⇒ Object

“at”, “new”, “with_data”, “with_properties”


95
96
97
# File 'lib/decoy/commands.rb', line 95

def make(opts={}) #["at", "new", "with_data", "with_properties"]
  app.make opts
end

#move(opts = {}) ⇒ Object

“to”


99
100
101
# File 'lib/decoy/commands.rb', line 99

def move(opts={}) #["to"]
  app.move opts
end

#open_location(opts = {}) ⇒ Object

“window”


107
108
109
# File 'lib/decoy/commands.rb', line 107

def open_location(opts={}) #["window"]
  app.open_location opts
end

#open_workflow(path, opts = {}) ⇒ Object



103
104
105
# File 'lib/decoy/commands.rb', line 103

def open_workflow(path, opts={}) #[]
  app.open path, opts
end
“print_dialog”, “with_properties”


111
112
113
# File 'lib/decoy/commands.rb', line 111

def print_page(opts={}) #["print_dialog", "with_properties"]
  app.print opts
end

#quit_app(opts = {}) ⇒ Object

“saving”


115
116
117
# File 'lib/decoy/commands.rb', line 115

def quit_app(opts={}) #["saving"]
  app.quit opts
end

#reload(opts = {}) ⇒ Object



119
120
121
# File 'lib/decoy/commands.rb', line 119

def reload(opts={}) #[]
  app.reload opts
end

#reopen(opts = {}) ⇒ Object



123
124
125
# File 'lib/decoy/commands.rb', line 123

def reopen(opts={}) #[]
  app.reopen opts
end

#run(opts = {}) ⇒ Object



127
128
129
# File 'lib/decoy/commands.rb', line 127

def run(opts={}) #[]
  app.run opts
end

#run_workflow(opts = {}) ⇒ Object

“with_variables”


131
132
133
# File 'lib/decoy/commands.rb', line 131

def run_workflow(opts={}) #["with_variables"]
  app.run_workflow app.document, opts
end

#save(opts = {}) ⇒ Object

“in”


135
136
137
# File 'lib/decoy/commands.rb', line 135

def save(opts={}) #["in"]
  app.save app.document, opts
end

#send_email_with(opts = {}) ⇒ Object

“body”, “from”, “password”, “port”, “smtp_server”, “subject”, “to”, “username”


139
140
141
# File 'lib/decoy/commands.rb', line 139

def send_email_with(opts={}) #["body", "from", "password", "port", "smtp_server", "subject", "to", "username"]
  app.send_email_with opts
end

#set(opts = {}) ⇒ Object

“to”


143
144
145
# File 'lib/decoy/commands.rb', line 143

def set(opts={}) #["to"]
  app.set opts
end

#set_contents_of_clipboard(opts = {}) ⇒ Object

“in”, “to_value_of_JavaScript”, “to_value_of_element_for_CSS_selector”, “to_value_of_element_for_XPath”, “to_value_of_element_with_id”, “to_value_of_element_with_name”


147
148
149
# File 'lib/decoy/commands.rb', line 147

def set_contents_of_clipboard(opts={}) #["in", "to_value_of_JavaScript", "to_value_of_element_for_CSS_selector", "to_value_of_element_for_XPath", "to_value_of_element_with_id", "to_value_of_element_with_name"]
  app.set_contents_of_Clipboard opts
end

#set_form_values(opts = {}) ⇒ Object

“for_CSS_selector”, “for_JavaScript”, “for_XPath”, “in”, “with_id”, “with_name”, “with_values”


151
152
153
# File 'lib/decoy/commands.rb', line 151

def set_form_values(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "with_id", "with_name", "with_values"]
  app.set_form_values opts
end

#set_value_of_element(opts = {}) ⇒ Object

“for_CSS_selector”, “for_JavaScript”, “for_XPath”, “in”, “in_form_for_CSS_selector”, “in_form_for_JavaScript”, “in_form_for_XPath”, “in_form_with_id”, “in_form_with_name”, “to”, “with_id”, “with_name”


155
156
157
# File 'lib/decoy/commands.rb', line 155

def set_value_of_element(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "in_form_for_CSS_selector", "in_form_for_JavaScript", "in_form_for_XPath", "in_form_with_id", "in_form_with_name", "to", "with_id", "with_name"]
  app.set_value_of_element opts
end

#set_variable(opts = {}) ⇒ Object

“in”, “to”, “to_contents_of_Clipboard”, “to_contents_of_file”, “to_value_of_JavaScript”, “to_value_of_XPath”, “to_value_of_element_for_CSS_selector”, “to_value_of_element_for_XPath”, “to_value_of_element_with_id”, “to_value_of_element_with_name”, “with_name”


159
160
161
# File 'lib/decoy/commands.rb', line 159

def set_variable(opts={}) #["in", "to", "to_contents_of_Clipboard", "to_contents_of_file", "to_value_of_JavaScript", "to_value_of_XPath", "to_value_of_element_for_CSS_selector", "to_value_of_element_for_XPath", "to_value_of_element_with_id", "to_value_of_element_with_name", "with_name"]
  app.set_variable opts
end

#show_actual_size(opts = {}) ⇒ Object



163
164
165
# File 'lib/decoy/commands.rb', line 163

def show_actual_size(opts={}) #[]
  app.show_actual_size opts
end

#stop_loading(opts = {}) ⇒ Object



167
168
169
# File 'lib/decoy/commands.rb', line 167

def stop_loading(opts={}) #[]
  app.stop_loading opts
end

#stop_workflow(opts = {}) ⇒ Object



171
172
173
# File 'lib/decoy/commands.rb', line 171

def stop_workflow(opts={}) #[]
  app.stop_workflow app.document, opts
end

#submit_form(opts = {}) ⇒ Object

“for_CSS_selector”, “for_JavaScript”, “for_XPath”, “in”, “with_id”, “with_name”


175
176
177
# File 'lib/decoy/commands.rb', line 175

def submit_form(opts={}) #["for_CSS_selector", "for_JavaScript", "for_XPath", "in", "with_id", "with_name"]
  app.submit_form opts
end

#wait_for_condition(opts = {}) ⇒ Object

“JavaScript_evaluates_true”, “XPath_evaluates_true”, “does_not_have_JavaScript_dialog_with_text”, “has_JavaScript_dialog_with_text”, “in”, “page_contains_text”, “page_does_not_contain_text”, “page_does_not_have_element_for_XPath”, “page_does_not_have_element_with_id”, “page_does_not_have_element_with_name”, “page_has_element_for_XPath”, “page_has_element_with_id”, “page_has_element_with_name”, “page_title_equals”, “page_title_is_not_equal”, “with_timeout”


179
180
181
# File 'lib/decoy/commands.rb', line 179

def wait_for_condition(opts={}) #["JavaScript_evaluates_true", "XPath_evaluates_true", "does_not_have_JavaScript_dialog_with_text", "has_JavaScript_dialog_with_text", "in", "page_contains_text", "page_does_not_contain_text", "page_does_not_have_element_for_XPath", "page_does_not_have_element_with_id", "page_does_not_have_element_with_name", "page_has_element_for_XPath", "page_has_element_with_id", "page_has_element_with_name", "page_title_equals", "page_title_is_not_equal", "with_timeout"]
  app.wait_for_condition opts
end

#wait_until_done(opts = {}) ⇒ Object

“with_timeout”


183
184
185
# File 'lib/decoy/commands.rb', line 183

def wait_until_done(opts={}) #["with_timeout"]
  app.wait_until_done app.document, opts
end

#zoom_in(opts = {}) ⇒ Object



187
188
189
# File 'lib/decoy/commands.rb', line 187

def zoom_in(opts={}) #[]
  app.zoom_in opts
end

#zoom_out(opts = {}) ⇒ Object



191
192
193
# File 'lib/decoy/commands.rb', line 191

def zoom_out(opts={}) #[]
  app.zoom_out opts
end