Class: WindowHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/watir/WindowHelper.rb

Constant Summary collapse

@@ie_window_name =
"Windows Internet Explorer"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWindowHelper

Returns a new instance of WindowHelper.



6
7
8
# File 'lib/watir/WindowHelper.rb', line 6

def initialize()
    @autoit = Watir.autoit
end

Class Method Details

.check_autoit_installedObject



40
41
42
43
44
45
46
# File 'lib/watir/WindowHelper.rb', line 40

def WindowHelper.check_autoit_installed
    begin
      Watir.autoit
    rescue
        raise Watir::Exception::WatirException, "The AutoIt dll must be correctly registered for this feature to work properly"
    end
end

Instance Method Details

#logon(title, name = 'john doe', password = 'john doe') ⇒ Object



32
33
34
35
36
37
38
# File 'lib/watir/WindowHelper.rb', line 32

def logon(title,name = 'john doe',password = 'john doe')
    @autoit.WinWait title, ""
    @autoit.Send name
    @autoit.Send "{TAB}"
    @autoit.Send password
    @autoit.Send "{ENTER}"
end

#push_alert_buttonObject



10
11
12
13
# File 'lib/watir/WindowHelper.rb', line 10

def push_alert_button
    @autoit.WinWait @@ie_window_name, ""
    @autoit.Send "{ENTER}"
end

#push_confirm_button_cancelObject



20
21
22
23
# File 'lib/watir/WindowHelper.rb', line 20

def push_confirm_button_cancel
    @autoit.WinWait @@ie_window_name, ""
    @autoit.Send "{ESCAPE}"
end

#push_confirm_button_okObject



15
16
17
18
# File 'lib/watir/WindowHelper.rb', line 15

def push_confirm_button_ok
    @autoit.WinWait @@ie_window_name, ""
    @autoit.Send "{ENTER}"
end

#push_security_alert_yesObject



25
26
27
28
29
30
# File 'lib/watir/WindowHelper.rb', line 25

def push_security_alert_yes
    @autoit.WinWait "Security Alert", ""
    @autoit.Send "{TAB}"
    @autoit.Send "{TAB}"
    @autoit.Send "{SPACE}"
end