Skip to content

Instantly share code, notes, and snippets.

@masbog
Created February 22, 2018 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masbog/8f1729f6a953a1fbb4185eb249859558 to your computer and use it in GitHub Desktop.
Save masbog/8f1729f6a953a1fbb4185eb249859558 to your computer and use it in GitHub Desktop.
SELENIUM WebDriver Python for https://typing-speed-test.aoeu.eu
tmpElem_input_words = WebDriverWait(self.driver, 2).until(EC.presence_of_element_located((By.XPATH, '//div[@id="wordsbox"]')))
current_text = WebDriverWait(tmpElem_input_words, 2).until(EC.presence_of_element_located((By.XPATH, '//span[@class="currentword"]')))
inputan = WebDriverWait(self.driver, 5).until(EC.presence_of_element_located((By.XPATH, "//input[@autocomplete='off' and @autocapitalize='none' and @placeholder='type the words here']")))
ActionChains(self.driver).move_to_element(inputan).perform()
spans = tmpElem_input_words.find_elements_by_tag_name("span")
for span in spans:
print(current_text.text)
listresp = list(map(list, current_text.text))
listff =[]
#print (listresp)
for charersp in listresp:
for charfinnal in charersp:
listff.append(charfinnal)
for char in listff:
#print(char)
inputan.send_keys(char)
time.sleep(0.05)
inputan.send_keys(' ')
time.sleep(0.05)
current_text = WebDriverWait(tmpElem_input_words, 2).until(EC.presence_of_element_located((By.XPATH, '//span[@class="currentword"]')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment