Garvit Galgat

EARLY COLLEGE · EXPERIMENT

TyperX bot

Getting the computer to do the typing

View source

Python · Selenium · JavaScript · PyAutoGUI · OpenCV · Tesseract OCR

I was curious about something I did every day: pressing keys to type.

Could I simulate those key presses? How fast could it go?

Pressing the keys

I wanted to try this on TyperX. If I could press the keys myself, could I get a program to do it? I started looking up how to simulate typing and trying things with Selenium.

The goal was just to get it to type. I didn’t have a plan for everything I would need to learn.

Finding the text

Then there was the text on the page. How could I get that into my program so it knew what to type?

That led me to web scraping. I had no clue what scraping was. I was just looking for a way to extract the text and use it. The first version used Selenium to find the words on the page, then Python to simulate the key presses.

I ended up using JavaScript too, without having learned the foundations first. I would try something, see what happened, and keep working at it.

Trying another way

I ran into issues with the Selenium version, so I tried another way. What if I read the text from a screenshot? I didn’t know what OCR was or what Tesseract did. I just wondered if I could get the words out of an image, and kept looking things up and trying until somehow it worked.

Looking back, OCR was overkill for text that was already on a web page. If I built this today, I wouldn’t even think of taking that route. But back then, I wasn’t weighing up approaches. I just wanted the bot to type, and any idea that might get me there was worth a try.

“I didn’t know enough to rule an idea out. I just wanted to see if it worked.”

That Selenium curiosity led to IPPG