This folder contains practical examples of using HumanTyping with different frameworks.
# From the root directory
pip install -e .[playwright]# Simple example (recommended for beginners)
python examples/simple_example.py
# Full Playwright example
python examples/playwright_example.py
# Selenium example
python examples/selenium_example.pyThe simplest possible example. Perfect for beginners.
from humantyping import HumanTyper
typer = HumanTyper(wpm=70)
await typer.type(element, "Hello world!")What it does:
- Opens Google
- Types a search query with realistic behavior
- Shows you how simple the API is
Run it:
python examples/simple_example.pyA more complete example with error handling and validation.
Features:
- Custom WPM configuration
- Input validation
- Real-world Google search scenario
Run it:
python examples/playwright_example.pyShows how to use HumanTyping with Selenium (synchronous).
Features:
- Synchronous API (
type_sync) - Compatible with selenium WebDriver
- Same realistic behavior
Run it:
python examples/selenium_example.pyWhen you run these examples, you'll see:
✅ Realistic typing speed - Not too fast, not too slow
✅ Natural errors - Occasional typos on adjacent keys
✅ Human-like corrections - Backspace when mistakes happen
✅ Variable pace - Faster for common words, slower for complex ones
✅ Natural pauses - Brief delays between words
All examples can be customized by adjusting the WPM:
# Slow typer
slow_typer = HumanTyper(wpm=40)
# Average typer (default)
normal_typer = HumanTyper(wpm=60)
# Fast typer
fast_typer = HumanTyper(wpm=90)
# Pro typer
pro_typer = HumanTyper(wpm=120)- Start with
simple_example.py- It's the easiest to understand - Watch the typing in action - Run with
headless=Falseto see it work - Experiment with WPM - Try different speeds to match your use case
- Check the console output - Examples print helpful information
Solution: Install the package first:
pip install -e .[playwright]Solution: Install Playwright:
pip install playwright
playwright install chromiumSolution: Adjust the WPM in the code:
typer = HumanTyper(wpm=80) # Change this valueHappy typing! 🎉