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

使用watir的close_all方法,有時(shí)會(huì)關(guān)閉不掉IE,***的Ruby關(guān)閉IE進(jìn)程辦法就是直接終止IE進(jìn)程,可以寫(xiě)一個(gè)關(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í)就可以實(shí)現(xiàn)Ruby關(guān)閉IE進(jìn)程了。
分享文章:Ruby關(guān)閉IE進(jìn)程采用直接關(guān)閉進(jìn)程法
本文路徑:http://fisionsoft.com.cn/article/djcciic.html


咨詢
建站咨詢
