hummusonrails / school-health-declaration-automation

Automate the daily school health declaration form
MIT License
5 stars 5 forks source link
automation hacktoberfest nokogiri ruby script selenium watir

School Health Declaration Automation Script

This is an automation script that will fill out the school's daily health declaration requirement for each child in the parent portal dashboard.

It can be run manually or can be connected to a scheduler to run once a day.

How To Use

Use as a GitHub Action

To use this without needing to run any code, you can use it as a GitHub Action in your own GitHub account. To do so follow these steps:

  1. Fork this repository to your account

  1. Create the secrets in your new repository by going to Settings > Secrets > Actions and clicking the "New Repository Secret" button for each new secret (don't accidentally add them as "Environment secrets"). Add the correct name for the secret in the "Name" field" and your value in the "Value" field. For the list of secrets you need refer to the Environment Variables section of this README.

  1. You can check the status of your automation by clicking on the "Actions" tab in your repository top navigation bar and then clicking on the "Antigen Test Declaration..." Workflow on the left-hand side navigation. A green check means it worked, and a red x mark means something went wrong. You can click on each individual item in the table to see the details.

Using The Gem

You can use this software as a Ruby gem by downloading it to your machine from Rubygems:

From the command line:

In your Gemfile:

Using The Code

You can use this script to either send:

Daily health declaration automation

To use the automation script locally on your machine:

Twice weekly antigen test declaration

To use the antigen test declaration automation script locally on your machine:

Environment Variables

You need to provide three environment variables for the daily automation script:

You need to provide the following environment variables for the twice weekly antigen test declaration form script:

Headless Browsing

The script is set to run in headless mode as it navigates to the school website and fills out the form, which means you won't see it complete the process. If you wish, you can set headless to false and watch it from your computer as it happens instead. To do so open up declare.rb and on line 14 or declare_antigen.rb on line 45 and change the code to:

browser = Watir::Browser.new :chrome, headless: false

Troubleshooting

"element click intercepted..."

If you are running the school antigen test declaration form and it fails with an error about the "element click intercepted" it is most likely because the reCAPTCHA on the website prompted for further verification.

There is no way to make the script work at this point. You need to manually go to the website and fill it out. The reCAPTCHA may reset the next time the script runs and not require the extra verification again.

Contributing

Contributions to the code are always welcome. You can either raise an issue to be discussed or submit a pull request directly. We try to follow the GitHub Flow when proposing new features.

License

This script is under the MIT License.