https://github.com/vaibhav-madan-20/testpad-automator
A python script to automate Testpad website
https://github.com/vaibhav-madan-20/testpad-automator
automation automator chitkara-university chitkara-university-rajpura chitkara-university-testpad homework-website-automator python python-selenium selenium testpad
Last synced: 4 months ago
JSON representation
A python script to automate Testpad website
- Host: GitHub
- URL: https://github.com/vaibhav-madan-20/testpad-automator
- Owner: vaibhav-madan-20
- Created: 2025-08-15T08:39:15.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-09-02T13:02:15.000Z (4 months ago)
- Last Synced: 2025-09-02T15:11:12.942Z (4 months ago)
- Topics: automation, automator, chitkara-university, chitkara-university-rajpura, chitkara-university-testpad, homework-website-automator, python, python-selenium, selenium, testpad
- Language: Java
- Homepage:
- Size: 32.7 MB
- Stars: 3
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# Testpad Automator
> Please give a GitHub star ⭐️ if you found this useful!
[Testpad](https://login.testpad.chitkara.edu.in/login) is an online course assessment portal used by Chitkara University. This Python program automates course completion by submitting answers from pre-existing solutions.
---
## Features
- **Complete Courses Automatically (`complete_course.ipynb`):**
This file allows you to automatically complete an entire Testpad course using answers from pre-existing solutions.
- The pre-existing solutions are to be stored in the `Testpad-Solutions` folder,.
- The program will log in to Testpad, navigate through each question, and submit the correct answers for you.
- This is useful for quickly finishing courses without manual effort.
- **Download Solutions (`download_answers.ipynb`):**
This file lets you extract and save your answers from a Testpad course that you have already completed.
- It will go through each question in the selected course and download your submitted answers.
- The answers are saved in a folder named after the course, with subfolders for each topic and question.
- Coding question answers are saved with their original file extension, while non-coding answers are saved as `Answer.txt`.
- These downloaded solutions can then be reused for future automation or shared with others.
## Steps to Run
1. **Install required libraries:**
```sh
python -m pip install selenium==4.22.0
```
2. **Create a `.env` file with your credentials:**
```
TESTPAD_EMAIL=
TESTPAD_PASSWORD=
```
3. **Run the script:**
- To complete a course: open and run `complete_course.ipynb`
- To download solutions: open and run `download_answers.ipynb`
## Instructions
**Keep the browser window in focus while the program runs.**
Do not focus away from browser. If you switch to another app or window, the program may fail to complete some questions.
#### What to Do If a Question Fails
Sometimes, a question may not get completed on the first attempt. This can happen if you switch away from the browser window, if a browser alert happens or if website takes longer than usual to respond.
- If this happens, the program will pause and show a message asking you to press Enter.
- Go to your program window, and press Enter as instructed.
- After pressing Enter, immediately switch back to the browser window and keep it in focus.
- The program will retry the question and continue with the rest of the course.
### Program Settings
#### Main settings
- `COURSE_NAME`: Type the exact name of the course you want to complete, as it appears on Testpad.
- `BROWSER`: Choose which browser to use (`CHROME` is default, or you can use `FIREFOX`).
#### Other settings
- `QUESTIONS_TO_BE_SKIPPED`: This is a list of questions that program will not attempt, due to some technical error on Testpad.
- `HEADLESS`: This setting controls whether the browser runs in the background (default: `FALSE`).
- If you set `HEADLESS` to `True`, you do **not** need to keep the browser window in focus (as browser would be non-visible).
- If `HEADLESS` is `False`, you **must** keep the browser window in focus for the program to fully work.
## Other information
### Logging
During course completion, logs are generated in the output cell. These logs show progress for each topic and question, showing which questions were attempted and completed. This enables you to know completion/download status.
**Example log output for `complete_course.ipynb`:**
```
1) Topic name- Recursion -1 (7 questions)
7/7 incomplete questions
1. Attempting question- Factorial using recursion (Coding)
Question successfully completed ✅
........
```
**Example log output for `download_answers.ipynb`:**
```
1. Recursion -1, (7 questions)
0/7 incomplete questions
Copying solution to question- Factorial using recursion (Coding)
Succesfully copied solution✅
........
```
---
### Folder Structure
The folder structure generated by `download_answers.ipynb` (and used in `Testpad-Solutions`) is:
```
Course name/
└── Subtopic name/
└── Question name/
├── Answer.txt # For non-coding questions
└── Question name.extension # For coding questions
```
### Contributing
Currently, solutions are available for two courses.
If you have complete solutions for additional courses (that are being currently evaluated) and would like to contribute:
1. Use the `download_answers.ipynb` program to download your solutions.
2. Move them to the `Testpad-Solutions` folder.
3. Submit a pull request.