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")?