Class: Watir::DialogButton

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

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ DialogButton

Returns a new instance of DialogButton.



29
30
31
# File 'lib/watir/dialog.rb', line 29

def initialize(name)
  @name = name
end

Instance Method Details

#clickObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/watir/dialog.rb', line 32

def click
  # TODO: register autoit before use
  autoit = WIN32OLE.new('AutoItX3.Control')
  autoit.WinWait Dialog::WindowName, "", 1
  name_pattern = Regexp.new "^#{@name}$"
  unless name_pattern =~ autoit.WinGetText(Dialog::WindowName, "")
    raise Watir::Exception::UnknownObjectException
  end
  autoit.Send "{ENTER}"
end