Class: AutoItHelper
- Inherits:
-
Object
- Object
- AutoItHelper
- Extended by:
- WatiRspec::Waiter
- Defined in:
- lib/watirspec/autoit.rb
Overview
Helper class for AutoIt
Constant Summary collapse
- @@autoit =
Watir.autoit
Class Method Summary collapse
-
.activate_window(window_title) ⇒ Object
makes window active with specified title * returns true if activation was successful and false otherwise.
-
.click_button(window_title, button_name) ⇒ Object
clicks specified button on window with specified title, activates window automatically and makes sure that the click was successful.
-
.click_save(window_title = "File Download") ⇒ Object
clicks save button on window with specified title, activates window automatically and makes sure that the click was successful.
-
.set_edit(field_value, window_title = "Save As") ⇒ Object
sets edit field value to field_value on window with specified title, activates window automatically and makes sure that the field’s value got changed.
-
.set_field(window_title, field_name, field_value) ⇒ Object
sets specified field’s value on window with specified title, activates window automatically and makes sure that the field’s value got changed.
Methods included from WatiRspec::Waiter
Class Method Details
.activate_window(window_title) ⇒ Object
makes window active with specified title
-
returns true if activation was successful and false otherwise
48 49 50 51 52 |
# File 'lib/watirspec/autoit.rb', line 48 def activate_window(window_title) @@autoit.WinWait(window_title, "", 1) == 1 && @@autoit.WinActivate(window_title) != 0 && @@autoit.WinActive(window_title) != 0 end |
.click_button(window_title, button_name) ⇒ Object
clicks specified button on window with specified title, activates window automatically and makes sure that the click was successful
37 38 39 40 41 42 43 44 |
# File 'lib/watirspec/autoit.rb', line 37 def (window_title, ) wait_until! do activate_window(window_title) && @@autoit.ControlFocus(window_title, "", ) == 1 && @@autoit.ControlClick(window_title, "", ) == 1 && wait_until(3) {@@autoit.WinExists(window_title) == 0} end end |
.click_save(window_title = "File Download") ⇒ Object
clicks save button on window with specified title, activates window automatically and makes sure that the click was successful
11 12 13 |
# File 'lib/watirspec/autoit.rb', line 11 def click_save(window_title="File Download") (window_title, "&Save") end |
.set_edit(field_value, window_title = "Save As") ⇒ Object
sets edit field value to field_value on window with specified title, activates window automatically and makes sure that the field’s value got changed
18 19 20 |
# File 'lib/watirspec/autoit.rb', line 18 def set_edit(field_value, window_title="Save As") set_field(window_title, "Edit1", field_value) end |
.set_field(window_title, field_name, field_value) ⇒ Object
sets specified field’s value on window with specified title, activates window automatically and makes sure that the field’s value got changed
25 26 27 28 29 30 31 32 |
# File 'lib/watirspec/autoit.rb', line 25 def set_field(window_title, field_name, field_value) wait_until! do activate_window(window_title) && @@autoit.ControlFocus(window_title, "", field_name) == 1 && @@autoit.ControlSetText(window_title, "", field_name, field_value) == 1 && @@autoit.ControlGetText(window_title, "", field_name) == field_value end end |