新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Ruby關(guān)閉IE進程采用直接關(guān)閉進程法
在Ruby語言的實際是代碼編寫中,我們會覺得它的編寫方式不同于其他語言,并且在編寫代碼時會有一種非常愉悅的心情。在這里我們就為大家介紹一下Ruby關(guān)閉IE進程的相關(guān)方法。#t#

使用watir的close_all方法,有時會關(guān)閉不掉IE,***的Ruby關(guān)閉IE進程辦法就是直接終止IE進程,可以寫一個關(guān)閉ie的方法
- require 'win32ole'
- # Returns the number
of windows
processes running with
the specified name. - def close_ie
- mgmt = WIN32OLE.connect
('winmgmts:\\\\.') - processes=mgmt.
instancesof("win32_process") - processes.each do |process|
- puts process
- if process.name ==
"iexplore.exe" then - process.terminate()
- end
- end
- end
這樣調(diào)用close_ie方法時就可以實現(xiàn)Ruby關(guān)閉IE進程了。
文章名稱:Ruby關(guān)閉IE進程采用直接關(guān)閉進程法
文章分享:http://www.5511xx.com/article/djcciic.html


咨詢
建站咨詢
