Module: Watir::Process

Defined in:
lib/watir/process.rb

Class Method Summary collapse

Class Method Details

.count(name) ⇒ Object

Returns the number of windows processes running with the specified name.



5
6
7
8
9
10
# File 'lib/watir/process.rb', line 5

def self.count name
  mgmt = WIN32OLE.connect('winmgmts:\\\\.')
  processes = mgmt.InstancesOf('win32_process')
  processes.extend Enumerable
  processes.select{|x| x.name == name}.length
end