This project automates typing on the MonkeyType website using Selenium WebDriver. The script can type out text in different ways (e.g., letter-by-letter, word-by-word, etc.) at a custom delay. It also captures the results like words per minute (WPM), accuracy, and consistency.
- Python 3.11+
- Install required libraries via the
requirements.txtfile.
-
Clone the repository:
git clone <repo-link>
-
Navigate to the project directory:
cd <folder-name>
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- For Windows:
.\venv\Scripts\activate
- For macOS/Linux:
source venv/bin/activate
- For Windows:
-
Install the dependencies:
pip install -r requirements.txt
-
The script will open a browser window and navigate to MonkeyType.
-
It will attempt to accept cookies if the prompt appears.
-
After that, you can run one of the typing functions to automate typing:
letterByLetter(delay): Types each letter one by one with a specified delay.allAtOnce(delay): Types all the letters of the current active word at once.wordByWord(delay): Types each word as a whole at the specified delay.wordLetterByLetter(delay): Types each word's letters individually, one after another.
You can customize the
delayparameter for each function to control typing speed. -
Once the typing session is complete, the script will print the typing results: WPM (words per minute), accuracy, and consistency.
Run the script like this:
delay = 0.001 # Set a small delay for fast typing
wordByWord(delay)To check your typing statistics after finishing the test:
wpm = browser.find_element(By.CSS_SELECTOR, ".group.wpm").find_element(By.CLASS_NAME, "bottom").text
acc = browser.find_element(By.CSS_SELECTOR, ".group.acc").find_element(By.CLASS_NAME, "bottom").text
consistency = browser.find_element(By.CSS_SELECTOR, ".group.flat.consistency").find_element(By.CLASS_NAME, "bottom").text
print("wpm: " + wpm)
print("accuracy: " + acc)
print("consistency: " + consistency)- If you encounter issues with stale elements, it may be due to dynamic content on the page. Ensure the page has fully loaded before interacting with elements.
- Make sure the
ChromeDriveris correctly installed and compatible with your Chrome version. Thewebdriver-managerpackage should handle this automatically.
- Fork the repository.
- Create a new branch for your feature or fix.
- Make your changes.
- Open a pull request with a description of what you've done.