An automated attendance logging system for GreatHR that handles sign-in/sign-out operations for multiple users with scheduled execution.
- Automated Attendance: Automatically logs into GreatHR and performs sign-in/sign-out operations
- Multi-user Support: Handles multiple user accounts from a single configuration -- Scheduled Execution: Runs automatically at user-defined times on weekdays
- Error Handling: Robust error handling with retry mechanisms
- Notification Support: Webhook integration for status notifications
- Cross-platform: Works on Windows, macOS, and Linux
- Python 3.7+
- Chrome browser installed
- Chrome WebDriver (automatically managed by Selenium 4.x)
- Clone the repository:
git clone https://github.com/mubashirm1/automate_greathr.git
cd automate_greathr- Install dependencies:
pip install -r requirements.txt- Set up your environment files:
Create .env.secret with your credentials:
USER1_USERNAME=your_username1
USER1_PASSWORD=your_password1
USER2_USERNAME=your_username2
USER2_PASSWORD=your_password2Create .env.shared for notifications (optional):
WEBHOOK=your_webhook_urlRun the main automation script:
from main import main
main()Start the scheduler for automatic execution:
python scheduler.pyThe scheduler will run the automation at the times you configure in scheduler.py.
automate_greathr/
├── main.ipynb # Main automation logic (Jupyter notebook)
├── module.ipynb # Core functions and utilities (Jupyter notebook)
├── scheduler.py # Scheduling configuration
├── requirements.txt # Python dependencies
├── README.md # This file
├── .env.secret # User credentials (not tracked)
└── .env.shared # Shared configuration (not tracked)
Add users to .env.secret following this pattern:
USERNAME_USERNAME=actual_username
USERNAME_PASSWORD=actual_passwordWhere USERNAME is a unique identifier for each user.
Modify scheduler.py to set your preferred execution times. See APScheduler documentation for details.
Set up webhook notifications in .env.shared:
WEBHOOK=https://your-webhook-url.com- Handles the complete login and attendance marking process
- Navigates shadow DOM elements for button interactions
- Includes proper wait times and error handling
- Parses credentials from environment files
- Returns structured dictionary for multi-user support
- Orchestrates the entire automation process
- Manages WebDriver instances and cleanup
- Implements retry logic for failed attempts
- Credential Loading: Reads user credentials from
.env.secret - Browser Automation: Uses Selenium to navigate the GreatHR portal
- Login Process: Automatically fills credentials and logs in
- Attendance Marking: Finds and clicks the sign-in/sign-out button
- Cleanup: Properly closes browser instances
- Retry Logic: Attempts up to 3 times per user if failures occur
- Never commit
.env.secretor.env.sharedfiles to version control - Store sensitive credentials securely
- Use environment variables in production environments
- Consider using encrypted credential storage for enhanced security
-
Chrome Driver Issues
- Ensure Chrome browser is installed and updated
- Selenium 4.x automatically manages WebDriver
-
Login Failures
- Verify credentials in
.env.secret - Check if GreatHR portal is accessible
- Ensure proper network connectivity
- Verify credentials in
-
Element Not Found
- Website structure might have changed
- Check if shadow DOM elements are still valid
- Update selectors in
greathr_loggerfunction
-
Scheduling Issues
- Verify your timezone settings
- Check system time and date
- Ensure Python process has necessary permissions
Key dependencies include:
selenium: Web automationAPScheduler: Task schedulingpython-dotenv: Environment variable managementimport-ipynb: Jupyter notebook importspytz: Timezone handling
See requirements.txt for the complete list.
For production deployment:
- Use a process manager like
pm2orsystemd - Set up logging for monitoring and debugging
- Configure proper error notifications
- Use secure credential management
- Monitor system resources
Example with pm2:
pm2 start scheduler.py --name "greathr-automation"
pm2 save
pm2 startup- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -am 'Add feature' - Push to branch:
git push origin feature-name - Create Pull Request
This tool is for educational and personal use only. Ensure compliance with your organization's policies regarding automated systems. Use responsibly and at your own risk.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or issues:
- Open an issue on GitHub
Note: This automation tool is designed for the GreatHR portal. Modifications may be needed for other GreatHR instances.