Skip to content

Python script that automates typing on the typing practice website MonkeyType using Selenium library to interact with the website allowing users to automatically type the given words.

Notifications You must be signed in to change notification settings

imjbassi/MonkeyType-AutoTyper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MonkeyType Auto Typer

Automate your typing practice on MonkeyType!

Dependencies & Installation (Windows)

ChromeDriver Selenium
ChromeDriver Selenium
Keyboard Argparse
Keyboard Argparse

You can also install required dependencies using pip install -r requirements.txt, and of course, make sure you have Python (version 3.6 or higher).

Running

Make sure the Chrome Driver path is set to the right executable.

In the script, it is set to sh chrome_driver_path = "C:\\ProgramData\\chocolatey\\lib\\chromedriver\\tools\\chromedriver.exe" but you may want to change it depending on where you have installed it.

At the bottom, the WPM is meant to be changed before running the script: typing_wpm = 150 This number is not completely accurate but it will get you around the number. Set it to whatever you want.

  • Command line arguments have been added to change the WPM directly, however you are free to change it in the script as well. The script is toggled through the SHIFT key.

Does not always pass bot detection and remember to use it at your own risk!

Code

  1. Importing Required Libraries:

    • Import necessary Python libraries and modules, including argparse, time, selenium, keyboard, and exceptions.
  2. Setting Up WebDriver and Command-Line Arguments:

    • Set up the Chrome WebDriver to control the browser.
    • Parse command-line arguments using argparse. Accepts the optional --wpm argument with a default value of 100.
  3. Opening the MonkeyType Website:

  4. Handling Cookie Popup:

    • The handle_cookie_popup() function waits for the cookie popup to appear and disappear using WebDriverWait and EC from selenium. Print error message on exception.
  5. Setting Up Mode and Clicking:

    • Wait for the "div[mode='words']" element to become clickable and click on it to select "words" mode.
  6. Calculating Typing Delay:

    • The calculate_typing_delay() function calculates the delay between typing each word based on target WPM and word length.
  7. Automating Typing:

    • The automate_typing() function controls typing.
    • Check "SHIFT" key press to toggle typing and wait until released.
    • If typing enabled, find active word and type it using ActionChains. Wait based on calculated delay and press "SPACE" key.
    • Catch exceptions like NoSuchElementException and WebDriverException.
  8. Running the Automation:

    • Set typing_wpm (e.g., 150) for desired WPM.
    • Call automate_typing() with args object as argument to start typing automation.
  9. Comments and Formatting:

    • Code is well-commented and properly formatted for readability.

Comments removed using http://www.removecomments.com/ and image created using https://carbon.vercel.app/

About

Python script that automates typing on the typing practice website MonkeyType using Selenium library to interact with the website allowing users to automatically type the given words.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages