Watir – handling hidden process in windows

Code:

def running(a)

running=`tasklist`

if running.include?(a)

puts “#{a} is already running in windows machine”

else

puts “#{a} is not running”

end

end

runnning(‘java.exe’)

#=>   java.exe is already running in windows machine

runnning(‘notepad.exe’)

#=> notepad.exe is not running

Where this code will useful:

We can able to chaeck the process is runnign or not — When Script need to close some opened Firefox windows or chrome windows

Advertisements

2 thoughts on “Watir – handling hidden process in windows

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s