Sha256: eed7f786b3ada9f2984340872239953f91058bb3f150d378301f45e167c8539f

Contents?: true

Size: 847 Bytes

Versions: 6

Compression:

Stored size: 847 Bytes

Contents

module Watir

  class JavascriptDialog
    WINDOW_TITLES = ['Message from webpage', 'Windows Internet Explorer','Microsoft Internet Explorer']

    def initialize(opts={})
      @opts = opts
    end

    def exists?
      javascript_dialog_window.exists?
    end

    def button(value)
      javascript_dialog_window.button(:value => value)
    end

    def close
      javascript_dialog_window.close
    end

    def text
      javascript_dialog_window.text
    end

    def javascript_dialog_window
      @window ||= ::RAutomation::Window.new(:title => @opts[:title] || /^(#{WINDOW_TITLES.join('|')})$/)
    end

    Watir::Container.module_eval do
      def javascript_dialog(opts={})
        JavascriptDialog.new(opts)
      end

      alias_method :dialog, :javascript_dialog
    end
  end
end





Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
watir-2.0.2 lib/watir/dialogs/javascript.rb
watir-2.0.2.rc1 lib/watir/dialogs/javascript.rb
watir-2.0.1 lib/watir/dialogs/javascript.rb
watir-2.0.0 lib/watir/dialogs/javascript.rb
watir-2.0.0.rc3 lib/watir/dialogs/javascript.rb
watir-2.0.0.rc2 lib/watir/dialogs/javascript.rb