require 'watir'
require 'win32ole'
ie = Watir::IE.new
ie.goto('http://www.www.com')
ie.form(:id,'password_form').text_field(:id,'text1').set '1234'
ie.form(:id,'password_form').text_field(:id,'text2').set '1234'
ie.form(:id,'password_form').text_field(:id,'text3').set '2345' #此时对话框自动弹出
require 'watir/ie'
@autoit = Watir.autoit
puts '=========================================='
res = @autoit.WinWait "Microsoft Internet Explorer", ""
alter_content = @autoit.ControlGetText("Microsoft Internet Explorer",'','Static2')
puts alter_content #输入alert中的提示信息
puts '=========================================='
@autoit.winactive("Microsoft Internet Explorer") # 这种方法不需要对话框在最前面都可以点到
@autoit.controlclick("Microsoft Internet Explorer", "", "Button1")
#@autoit.Send "{TAB}" # 这种方法需要对话框在最前面才可以点到
#@autoit.Send "{TAB}"
#@autoit.Send "{SPACE}"
end
newthred()