读书人

Watir封闭所有IE窗口的3种方法

发布时间: 2012-09-21 15:47:26 作者: rapoo

Watir关闭所有IE窗口的3种方法

1. 循环

def close_all_windows  loop do    begin      Watir::IE.attach(:title, //).close    rescue Watir::Exception::NoMatchingWindowFoundException      break    rescue      retry    end  endend

?

2. 调用waitr API

require 'watir/close_all'Watir::IE.close_all

?

3. 结束进程

system("taskkill /t /f /im iexplore.exe")
?

读书人网 >编程

热点推荐