Last active
April 24, 2023 13:50
-
-
Save bobquest33/6352321 to your computer and use it in GitHub Desktop.
Automating Time Sheet Booking in CA Clarity using watir-webdriver and internet explorer or firefox. This script helps to login, select the timesheet for a week and then fill it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "watir-webdriver" | |
browser = Watir::Browser.new :ie | |
# Goto Workwise | |
browser.goto( 'workwise URL' ) # Workwise URL | |
# Do login | |
browser.text_field( :name, 'userName' ).set( 'user' ) #user | |
browser.text_field( :name, 'passWord' ).set( 'password' ) #password | |
browser.button( :name, 'submit' ).click | |
# click timesheet link | |
browser.link( :text, 'Timesheets' ).click | |
#Click on the first available week timesheet | |
browser.link( :id, 'manageTimesheet' ).wait_until_present | |
browser.link( :id, 'manageTimesheet' ).click | |
# Get the list of tasks | |
browser.button( :text, 'Add Task' ).click | |
# Get the list of tasks and click | |
browser.checkbox( :class, 'checkbox' ).set | |
browser.button( :text, 'Add' ).click | |
# search all text fields in timesheet | |
txtFields = browser.text_fields.select{|x| x.name == "actuals_hours"}.map{|x| x} | |
txtFields.each do |txt_Box| | |
puts txt_Box.alt.to_s | |
# Fill the time for working days in the week | |
if ! txt_Box.alt.to_s.include?"Sun" and ! txt_Box.alt.to_s.include?"Sat" | |
txt_Box.set( '8' ) | |
end | |
end | |
browser.button( :text, 'Submit for Approval' ).click | |
browser.link( :id, 'manageTimesheet' ).wait_until_present | |
browser.checkbox( :class, 'checkbox' ).set | |
browser.button( :text, 'Approve' ).click | |
browser.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment