One of my friends posted this in our Google Classroom:

Google Docs

It was quite obvious it was meant to be a joke and not meant to be taken seriously. Having some free time then, I decided to have a little fun.

I answered the Google Doc ... 24000 times.

Whether it's repetitive web-based administration tasks or crawling the web to read stock data (which I recently finished making) or fun little pranks on our classmates, interacting with websites by entering forms or reading data from websites can be automated.


Selenium is a great, free tool for automatically interacting with websites.

It has the ability to:

  1. Click on buttons and links
  2. Enter text in form fields
  3. Read text
  4. Find HTML elements
  5. And a lot more

Selenium Setup

The web browser we would use is Firefox. I prefer Chrome, but there’s some weird stuff with Chrome so I didn’t use it.

In order to use Firefox, install geckodriver and add geckodriver to the PATH (windows):

Windows PATH Change

Install Selenium as so (for Python):

pip install -U selenium


In order to identify elements to interact with, we use the element's XPath because while it may lack a class or id, every element has an unique XPath.

We can find an element’s XPath by using ‘inspect element’ and clicking ‘Copy XPath’ as so:

Copy XPATH from Website

Sample Code

The code below is able to interact with this form, read the password, enter it in the textbox, click the "Not Secure" button, and click submit after 5 seconds.

My password is SecretPassword1#

The password:

How secure is the password?


Not Secure

import time
from selenium import webdriver

url = ""
# replace path with the folder where you keep geckodriver.exe
path = "C:\\Users\\panda\\Desktop\\Python\\Selenium" 

browser = webdriver.Firefox(path)
time.sleep(1) # wait for the page to load

password = browser.find_element_by_xpath('/html/body/div[4]/div/div/form/p[1]/span[2]').text

# enter password in field
# click "not secure" button

time.sleep(5) # wait a few seconds before submitting
# click submit

Please do not spam Google Docs. I included it as a fun anecdote and was given permission.