Skip to content

Kev-in123/google-forms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google forms

Use this code to fill in a google form.

You can also use this to automate any browser task.

Backstory

When virtual learning started due to covid, we had a google form to fill in for attendance. At that time, I felt that it was pointless to fill-in and submit the same form everyday. So then, I decided to use python and automate this task. When I first started this, it only worked with 1 browser. When I tested it on a differet browser, I realized that it had performed a bit differently. Now it has support for 3 different browsers.

Before using the code, note that selemium has been updated and xpaths are used differently. Now you would probably use

from selenium.webdriver.common.by import By
...
driver.find_element(By.XPATH, '//*[@id="Email"]')

Instructions

  1. Download Python along with pip (you will need to do this manually during the installation of python)
  2. Open cmd (command prompt) and type pip install selenium
  3. Download any code editor that can run python. I use VS code with a python extension.
  4. Download geckodriver (Mozilla Firefox), chromedriver (Chrome) or msedgedriver (Microsoft Edge) and place it in some directory.
  5. After you install a driver go to the corresponding folder
  6. Download the files
  7. Edit config.json accordingly
  8. You might need to change the email in the main.py file to add a number depending on how your email systems work for example from:
    {firstName}.{lastName}@gmail.com to {firstName}.{lastName}[email protected]
    you might need to change the email depending on the form and your domain.
  9. Run the main.py file

Notes

  • You could open the file with a normal text editor, and run the file from the command line.

  • If you want to use a specific driver, you need the corresponding browser.

To find an elements xpath:

First open the inspector step 1 Then select the element step 2 Finally right click, select copy, and select xpath step 3

All the xpaths were fetched from Google Chrome but the examples use Mozilla Firefox

haven't tested since last commit

About

Use this code to fill in a google form

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages