Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Useless typing test bot

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]

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/


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by WhiteTiger.Jun 6, 2018 05:57 AM 3 144 Jun 6, 2018 05:57 AM
Last Post: koolkid
[Java] by EnskyMar 24, 2017 06:26 AM 1 248 Mar 24, 2017 06:26 AM
Last Post: Ensky
[Shell] by SkidyMar 20, 2017 01:12 PM 1 111 Mar 20, 2017 01:12 PM
Last Post: OkeFuk