使用watir的close_all方法,有时会关闭不掉IE,最好的办法就是直接终止IE进程,可以写一个关闭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

这样调用close_ie方法时就可以关闭IE进程了。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-05-16
  • 2021-11-23
  • 2021-06-12
  • 2022-01-06
猜你喜欢
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-06-21
相关资源
相似解决方案