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

使用watir的close_all方法,有時會關(guān)閉不掉IE,***的Ruby關(guān)閉IE進(jìn)程辦法就是直接終止IE進(jìn)程,可以寫一個關(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方法時就可以實(shí)現(xiàn)Ruby關(guān)閉IE進(jìn)程了。
網(wǎng)頁題目:Ruby關(guān)閉IE進(jìn)程采用直接關(guān)閉進(jìn)程法
標(biāo)題來源:http://www.dlmjj.cn/article/djcciic.html


咨詢
建站咨詢
