Sha256: 55c3e929043cb9f38082cc4363fd263c9925b2db0674cd269bb1aaf81ef1d309

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

require 'watir/win32ole'
require 'watir/ie' # for Watir.autoit

class WindowHelper
    @@ie_window_name = "Windows Internet Explorer"
    def initialize()
        @autoit = Watir.autoit
    end
    
    def push_alert_button
        @autoit.WinWait @@ie_window_name, ""
        @autoit.Send "{ENTER}"
    end
    
    def push_confirm_button_ok
        @autoit.WinWait @@ie_window_name, ""
        @autoit.Send "{ENTER}"
    end
    
    def push_confirm_button_cancel
        @autoit.WinWait @@ie_window_name, ""
        @autoit.Send "{ESCAPE}"
    end
    
    def push_security_alert_yes
        @autoit.WinWait "Security Alert", ""
        @autoit.Send "{TAB}"
        @autoit.Send "{TAB}"
        @autoit.Send "{SPACE}"
    end
        
    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
    
    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
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watir-1.6.5 lib/watir/WindowHelper.rb