Python package to simulate human keyboard typing
Use the package manager pip to install human_typer.
pip install human_typerFor Playwright support:
pip install human_typer[playwright]from human_typer import Human_typer
My_Typer = Human_typer(keyboard_layout = "qwerty", average_cpm = 190)
# Directly with keyboard
My_Typer.keyboard_type("my text")
# With a Selenium element
my_element = driver.find_element_by_id("ID")
My_Typer.type_in_element("my text", my_element)
# With optional custom typo error rate (default is 0.02 = 2% of every character typed)
My_Typer = Human_typer(keyboard_layout = "qwerty", average_cpm = 190, error_rate = 0.05)
# With a Playwright element (requires: pip install human_typer[playwright])
from playwright.sync_api import sync_playwright
My_Typer = Human_typer(element_type="playwright")
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://example.com")
element = page.locator("#my-input")
My_Typer.type_in_element("my text", element)
browser.close()Pull requests are welcome 😊