---
# System prepended metadata

title: Homework 11

---

# Homework 11
```python=+
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
import random
import time

option = webdriver.ChromeOptions()
option.add_argument("-incognito") 

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=option)

driver.get("https://docs.google.com/forms/d/e/1FAIpQLSdBXaRTyzHILNcb7KtLf-AMl8XKe8v2RPcM9vLBqh2Dkg8QaA/viewform"
)

def Auto_Fill():
    xpath = '//*[@id="mG61Hd"]/div[2]/div/div[2]/div[1]/div/div/div[2]/div/div[1]/div/div[1]/input'
    name_element = driver.find_element(By.XPATH, xpath)

    print(name_element)
    Name = [chr(65+i) for i in range(26)]
    s = random.choice(Name)
    name_element.send_keys(s)

    random_no = random.sample(range(0, 4), random.randint(1,4))
    random_no.sort()
    
    class_name = "eBFwI"
    check_element = driver.find_elements(By.CLASS_NAME, class_name)

    for no in random_no:
        check_element[no].click()
        time.sleep(random.randint(1,2))
    select_element = driver.find_elements(By.CLASS_NAME, "nWQGrd.zwllIb")
    select_element[random.randint(0,3)].click()
    time.sleep(random.randint(1,2))

    element = driver.find_element(By.XPATH, '//*[@id="mG61Hd"]/div[2]/div/div[3]/div/div[1]/div')

    print("提交", element)
    element.click()

    xpath = '/html/body/div[1]/div[2]/div[1]/div/div[4]/a'
    another_form = driver.find_element(By.XPATH, xpath)
    print("another ", another_form)
    another_form.click()

for _ in range(3):
    Auto_Fill()
```