Sha256: a9156f4aa2884a26d58aab7290d164821baa4cefdbdc7ab622a118ee950df7e7

Contents?: true

Size: 600 Bytes

Versions: 5

Compression:

Stored size: 600 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 Browser
    # 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

5 entries across 5 versions & 1 rubygems

Version Path
watir-classic-4.3.0 lib/watir-classic/process.rb
watir-classic-4.2.0 lib/watir-classic/process.rb
watir-classic-4.1.0 lib/watir-classic/process.rb
watir-classic-4.0.1 lib/watir-classic/process.rb
watir-classic-4.0.0 lib/watir-classic/process.rb