Table of Contents

Monitor Website / WebApp

There is many tool available in market to monitor websites.
Many of them fail on hard to use or does not serve purpose.
This script is simply used to generate test case.
Easy to configure / install for system admin.

Requirement

Installation

Script

This is sample script worked for my purpose you might need to modify accordingly.
See Documentation for further Detail - Celerity

| moniter.rb
require "rubygems"
require "celerity"
 
browser = Celerity::Browser.new
browser.goto('http://www.k2pate.in')
browser.text_field(:name, 'Username').value = 'test-user'
browser.text_field(:name, 'Password').value = 'test-password'
browser.button(:name, 'SubmitButton').click
puts "yay" if browser.text.include? 'SUMMER IS HERE . . .'
 
browser.goto('http://www.k2patel.in/DCM/criteria.aspx?ID=1363&persist=1&selectedname=User,%20Test&selectedid=9897')
browser.text_field(:name, 'KickReason').value = 'test'
browser.button(:name, 'PreviewButton').click
puts "yak" if browser.text.include? 'To Say Thank You For:'
 
browser.goto('http://www.k2patel.in/dcm/AboutCatalog.aspx?d')
browser.select_list(:name, 'CategoryDropDown').select('All Categories')
# browser.select_list(:name, 'PerPageDropDown').select_value = '50'
# paglink.click_and_attach
browser.select_list(:name, 'PerPageDropDown').select('50 per page')
puts "yam" if browser.button(:name, 'NextButton2').exists

You can execute script with time to get execution time.