There is this website my teacher makes us use to improve our typing skills. Our assignment is due next month and I am too lazy and want to make a program using selenium, a python module. Everything is working according to plan accept one thing, how do I type on the browser. You don't type in a text box. Here is my code:
from selenium import webdriver
driver = webdriver.Chrome('/Users/iyadmajid/Desktop/chromedriver')
driver.set_page_load_timeout(30)
driver.get('https://www.typing.com/student/login')
driver.implicitly_wait(20)
driver.find_element_by_id('username').send_keys('the_username')
driver.find_element_by_name('password').send_keys('the_password')
driver.find_element_by_class_name('submit-login').click()
driver.find_element_by_xpath("//a[@href='/student/lessons/380/numeric-
keypad']").click()
driver.find_element_by_xpath("//a[@class='button begin-button tooltip-
trigger']").click()
This is what the screen looks like after the code finishes executing: the website. I tried using send_keys('6') but that doesn't work. Here is what website code looks like: the website code. Again, if there is a way to type keys on the browser directly, please let me now.
There is, try the PyAutoGui module. It can be installed with pip and can press keys. An example that presses the y key:
import pyautogui
pyautogui.press('y')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With