I just started playing around with python. Recently I stumbled upon web scraping and I thought that it would not be that hard to make a Kahoot (https://kahoot.it/) bot. You may or may not know what I'm talking about. That's not important now. What I need is to create program that would fill out a game id and then a nickname but when I try and run the program I get error.
mechanize._mechanize.FormNotFoundError: no form matching name 'gameId'
import re
import config
from mechanize import Browser
br = Browser()
br.set_handle_robots(False)
br.addheaders = [('User-agent', 'Firefox')]
br.open ("https://kahoot.it/")
br.select_form('gameId')
br.form['game-pin-input'] = '6105440'
This is the form.
<form action="#">
<input name="gameId" type="tel" placeholder="Game PIN" id="game-input" data-functional-selector="game-pin-input" class="sc-dlfnbm lflLbn" autocomplete="off" value="" aria-expanded="false">
<button type="submit" value="Submit" class="enter-button__EnterButton-sc-1o9b9va-0 kfzgPK" data-functional-selector="join-game-pin">Enter</button>
</form>
I even tried finding the form name with a script but i got no return.
import os, subprocess
import re
import mechanize
from bs4 import BeautifulSoup
br = mechanize.Browser()
br.set_handle_robots(False)
br.addheaders = [('User-agent', 'Firefox')]
br.open ("https://kahoot.it/")
for form in br.forms():
print (form.name)
Please keep in mind that this is my first time dealing with html and I am not by any means experienced. Thank you.