import time
import pandas as pd
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
#Type in your email or username
email = 'email'
password = 'password'
#set up the webdriver
driver = webdriver.Chrome()
#go to kahoot login
driver.get('https://create.kahoot.it/auth/login')
#type kahoot account credentials
driver.implicitly_wait(5)
driver.find_element(By.ID, 'username').send_keys(f"{email}")
driver.find_element(By.ID, 'password').send_keys(f"{password}")
#get rid of potential popup
try:
driver.find_element(By.CSS_SELECTOR, 'button[id="onetrust-pc-btn-handler"]').click()
driver.find_element(By.CSS_SELECTOR, 'button[class="ot-pc-refuse-all-handler"]').click()
print("skipped cookie popup")
except:
print("no cookie popup")
#press login
driver.find_element(By.CSS_SELECTOR, 'button[id="login-submit-btn"]').click()
WebDriverWait(driver, 20).until(EC.url_contains("create.kahoot.it"))
#go to kahoot account's library
driver.find_element(By.CSS_SELECTOR, 'a[data-functional-selector="side-bar-link__library"]').click()
#create folder to put the kahoot quiz in
driver.find_element(By.CSS_SELECTOR, 'button[data-functional-selector="library_side-bar_create-folder"]').click()
folder_name = input('Folder Name: ')
driver.find_element(By.CSS_SELECTOR, 'input[placeholder="New folder"]').send_keys(f'{folder_name}', Keys.ENTER)
driver.find_element(By.CSS_SELECTOR, f'a[data-functional-selector="library_side-bar_{folder_name}"]').click()
#begin to create kahoot quiz
driver.find_element(By.CSS_SELECTOR, 'button[class="button__Button-sc-c6mvr2-0 iwRYhY"]').click()
driver.find_element(By.CSS_SELECTOR, 'button[class="styles__FlowOptionInnerContainer-sc-hcxgxq-2 gmFgAG"]').click()
driver.find_element(By.CSS_SELECTOR, 'button[class="flat-button__FlatButton-sc-6uljam-0 iEWtrJ"]').click()
driver.find_element(By.CSS_SELECTOR, 'button[aria-label="Close Themes panel"]').click()
#change the answer type
driver.find_element(By.CSS_SELECTOR, 'div[class=" css-cg5h5h-container"]').click()
I’m trying to use a spreadsheet to automatically make a “Type Answer” Kahoot quiz. I tried to look for the options for the “Question Type” in html, but I couldn’t find anything. I just began coding so if you have any critiques or advice feel free.
New contributor
Richmond Nguyen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.