Open In App

Automatically filling multiple responses into a Google Form with Selenium and Python

Last Updated : 19 Aug, 2021
Like Article

Prerequisite: Selenium

Selenium is a powerful tool for controlling web browsers through programs and performing browser automation. It is functional for all browsers, works on all major OS and its scripts are written in various languages i.e. Python, Java, C#, etc.. we will be working with Python. Selenium Tutorial covers all topics such as– WebDriver, WebElement, Unit Testing with selenium. 

The Task here is to fill multiple responses with the same Google form using selenium in python. Link to the Google form used in this example is given below:

Form link – Click Here


The form has five entries:

  • Name
  • Email
  • Address
  • Phone Number
  • Comments

Name, Email & Phone Number has same class name quantumWizTextinputPaperinputInput and Address & Comments has same class name quantumWizTextinputPapertextareaInput. Data is in the form of a list.

The given program also uses count, reason being textboxes contain a list, whose class name is “quantumWizTextinputPaperinputInput” and textareaboxes contain a list, whose class name is “quantumWizTextinputPapertextareaInput” and when these two classes are added it results in a list. The data is also provided in a form of a list, thus count variable will be incremented with each data variable.


# values of data

[name, email, phone number, address, comments]
datas = [
   [‘Mary D Joiner’,’’,’4079025063′,’2474  McDonald Avenue,Maitland’,’NA’],
   [‘Karen B Johnson’,’’,’3153437575′,’2143  Oak Street,GRAND ISLE’,’NA’],


To achieve our required functionality given steps needs to followed in a perfect order:

  • Import selenium and time module
  • Add chrome driver path and Form URL
  • Add some delay, until page gets fully loaded
  • Add data in the form of list
  • Iterate through each data and fill detail
  • Close the window



# Import Module
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
# open Chrome
driver = webdriver.Chrome(
# Open URL
# wait for one second, until page gets fully loaded
# Data
datas = [
    ['Mary D Joiner', '', '4079025063',
        '2474  McDonald Avenue,Maitland', 'NA'],
    ['Karen B Johnson', '',
        '3153437575', '2143  Oak Street,GRAND ISLE', 'NA'],
# Iterate through each data
for data in datas:
    # Initialize count is zero
    count = 0
    # contain input boxes
    textboxes = driver.find_elements_by_class_name(
    # contain textareas
    textareaboxes = driver.find_elements_by_class_name(
    # Iterate through all input boxes
    for value in textboxes:
        # enter value
        # increment count value
        count += 1
    # Iterate through all textareas
    for value in textareaboxes:
        # enter value
        # increment count value
        count += 1
    # click on submit button
    submit = driver.find_element_by_xpath(
    # fill another response
    another_response = driver.find_element_by_xpath(
# close the window


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads