Giter VIP home page Giter VIP logo

yanbrasiliano / automatic-clockin Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 11 KB

An example demonstrating automated login and point registration using Python 3 and Selenium. This script showcases how to navigate a website, enter login credentials, and record points or interactions on the platform, ensuring efficient and repetitive task handling.

License: MIT License

Python 100.00%
python3 automation selenium selenium-webdriver

automatic-clockin's Introduction

Automated Login and Point Registration

This project automates the login process and point registration for an intranet system using Selenium.

Prerequisites

  • Python 3.x
  • Google Chrome
  • Chromedriver

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/automatic-clockin.git
    cd automatic-clockin
  2. Create a virtual environment:
    python3 -m venv myenv
    source myenv/bin/activate  # On Windows use `myenv\Scripts\activate`
  3. Install the dependencies:
    pip install -r requirements.txt

Integration with Telegram

This project can also send a confirmation message to your Telegram bot before executing the point registration script. Follow these steps to set it up:

1. Create a Telegram Bot

  • Open Telegram and search for BotFather.
  • Start a chat with BotFather and use the command /newbot to create a new bot.
  • Follow the instructions to set up your bot and get the bot token.

2. Get the Chat ID

  1. Run the script to get the chat_id:
    python get_chat_id_and_update_env.py
  2. Open a chat with your bot on Telegram and send /start. The bot will reply with your chat_id and update the .env file automatically.

3. Configure the .env file

Ensure your .env file contains the following variables: TELEGRAM_TOKEN=your_telegram_bot_token CHAT_ID=your_obtained_chat_id_here LOGIN=your_login_value PASSWORD=your_password_value URL=your_url_here SCREENSHOT_PATH=/path/to/screenshot/directory SCRIPT_PATH=/path/to/point/registration/script

4. Sending Messages and Handling Responses

Run the script to send a message and handle responses: sh python send_telegram_message.py

5. Schedule the Script

You can schedule the script to run at specific times using cron jobs on Unix systems or Task Scheduler on Windows.

For example, to run the script every weekday at specific times, add the following lines to your crontab: sh 50 7 * * 1-5 python3 /path/to/send_telegram_message.py 00 12 * * 1-5 python3 /path/to/send_telegram_message.py 30 13 * * 1-5 python3 /path/to/send_telegram_message.py 05 18 * * 1-5 python3 /path/to/send_telegram_message.py This will send a message to your Telegram bot at 7:50 AM, 12:00 PM, 1:30 PM, and 6:05 PM every weekday.

Testing the Integration Manually

  1. Obtain the chat_id:

    • Execute get_chat_id_and_update_env.py:
      python get_chat_id_and_update_env.py
    • Open a chat with your bot on Telegram and send /start. The bot will reply with your chat_id and update the .env file.
  2. Test the Telegram integration:

    • Run send_telegram_message.py:
      python send_telegram_message.py
    • Respond to the message on Telegram to see if the script behaves as expected.
  3. Run the point registration script:

    • Execute index.py:
      python index.py

Troubleshooting

  • If you encounter any issues, ensure that the .env file is correctly configured and that the required dependencies are installed.

License

Distributed under the MIT License. See LICENSE for more information.

automatic-clockin's People

Contributors

yanbrasiliano avatar

Stargazers

AJ avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.