This Python script automates the process of logging into an account and submitting a payment using Selenium WebDriver. It also sends notifications via email and SMS regarding the payment status.
- Automated login to a specified account.
- Submission of payment details including card information.
- Validation of payment amount.
- Email and SMS notifications for successful or failed payments.
- Logging of important events and errors.
To run this script, you need the following:
- Python 3.x
- Selenium
python-dotenv
for environment variable management- A Gmail account for sending email notifications (with "Allow less secure apps" enabled or use an App Password)
- Chrome WebDriver compatible with your Chrome browser version
-
Clone the repository:
git clone https://github.com/yourusername/python-automated-billing.git cd python-automated-billing
-
Install required packages:
You can install the required packages using pip:
pip install selenium python-dotenv
-
Download Chrome WebDriver:
Download the Chrome WebDriver from ChromeDriver downloads and place it in the
chromedriver-win64
directory within your project folder. -
Set up environment variables:
Create a
.env
file in the root of your project directory with the following variables:LOGIN_PAGE=https://example.com/login ACCOUNT_NUMBER=your_account_number LAST_NAME=your_last_name CARD_NUM=your_card_number CARD_MONTH=your_card_expiry_month CARD_YEAR=your_card_expiry_year CARD_CVV=your_card_cvv PHONE_NUM=your_phone_number APP_PASSWORD=your_gmail_app_password
-
Run the script:
You can run the script from the command line:
python main.py
-
Debugging Mode:
To enable debugging mode (which keeps the browser open after execution), set
debugging = True
in the script.
The script logs important events and errors to an in-memory string stream. You can print these logs to the console if debugging is enabled or send them via email.
- Make sure to handle sensitive information carefully, especially when dealing with payment details.
- Adjust the timeout settings in the
wait_for_element
function if necessary to suit your internet speed. - The script currently uses Gmail for sending notifications; you may need to adjust SMTP settings if using a different email provider.
This project is licensed under the MIT License - see the LICENSE file for details.