Sha256: 094dad3083fd6d0162e7495b53abc99ddcb7d470a06537aa170382bb358c73c6

Contents?: true

Size: 1.24 KB

Versions: 13

Compression:

Stored size: 1.24 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

13 entries across 13 versions & 1 rubygems

Version Path
watir-1.8.1 lib/watir/WindowHelper.rb
watir-1.8.1.rc1 lib/watir/WindowHelper.rb
watir-1.8.0 lib/watir/WindowHelper.rb
watir-1.8.0.rc1 lib/watir/WindowHelper.rb
watir-1.7.1 lib/watir/WindowHelper.rb
watir-1.7.0 lib/watir/WindowHelper.rb
watir-1.7.0.rc1 lib/watir/WindowHelper.rb
watir-1.6.7 lib/watir/WindowHelper.rb
watir-1.6.7.rc1 lib/watir/WindowHelper.rb
watir-1.6.6 lib/watir/WindowHelper.rb
watir-1.6.6.rc2 lib/watir/WindowHelper.rb
watir-1.6.6.rc1 lib/watir/WindowHelper.rb
watir-1.6.2 lib/watir/WindowHelper.rb