Sha256: 56e36caf3c73e45590ddbc6d2a7e3c405d0aa322a41c9af5aacc2f34161fe413

Contents?: true

Size: 595 Bytes

Versions: 4

Compression:

Stored size: 595 Bytes

Contents

module Watir
  # @private
  module Process
    
    # Returns the number of windows processes running with the specified name.
    def self.count(name)
      mgmt = WIN32OLE.connect('winmgmts:\\\\.')
      processes = mgmt.InstancesOf('win32_process')
      processes.extend Enumerable
      processes.select{|x| x.name == name}.length
    end
    
  end
  
  class IE
    # Returns the number of IEXPLORE processes currently running.
    # @return [Fixnum] number of ie processes.
    def self.process_count
      Watir::Process.count 'iexplore.exe'
    end    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
watir-classic-3.7.0 lib/watir-classic/process.rb
watir-classic-3.6.0 lib/watir-classic/process.rb
watir-classic-3.5.0 lib/watir-classic/process.rb
watir-classic-3.4.0 lib/watir-classic/process.rb