Someone challenged me to a typing test, so I threw this shitty bot together in about ten minutes.
(runs faster than a Java version for some reason)
![[Image: 1a543cbe17ef99112627ebd0225032ba.png]](https://i.gyazo.com/1a543cbe17ef99112627ebd0225032ba.png)
Needs Chrome Driver in the same directory to run. You can get it from here
https://chromedriver.storage.googleapis....path=2.28/
(runs faster than a Java version for some reason)
![[Image: 1a543cbe17ef99112627ebd0225032ba.png]](https://i.gyazo.com/1a543cbe17ef99112627ebd0225032ba.png)
PHP Code
<?php
from selenium import webdriver
import time
class Typer:
wordsList = []
def __init__(self, url:str):
self.url = url
self.driver = webdriver.Chrome()
self.driver.get(url)
self.setWords()
def setWords(self):
''' Scrapes the words on the page so they are in an array to speed things up. '''
all_words = self.driver.find_elements_by_xpath('//*[@id="words"]/span')
for word in all_words:
self.wordsList.append(word.get_attribute('innerHTML'))
def run(self):
''' Runs the program '''
input = self.driver.find_element_by_id('input')
for w in self.wordsList:
input.send_keys(w + " ")
typer = Typer('http://typing-speed-test.aoeu.eu/')
typer.run()
Needs Chrome Driver in the same directory to run. You can get it from here
https://chromedriver.storage.googleapis....path=2.28/

