I'm creating a basic script that picks a random code from your Discord 2FA backup code text file, and then puts that into the 2fa box and submits that during login. I've already completed getting the bot to enter your email and password and login initially, as well as pick a random code from that text file.
My current issue is that Selenium for some reason can not find the box to enter the 2fa code into: https://gyazo.com/52ca628569f351fec1306332da7e1045
The html for that is:
<input class="inputDefault-_djjkz input-cIJ7To" name="" type="text" placeholder="6-digit authentication code" aria-label="Enter Discord Auth Code" autocomplete="off" maxlength="10" spellcheck="false" value="">
So I'm using
codefill = browser.find_element_by_xpath("""//*[@id="app-mount"]/div[1]/div/div[2]/div/form/div/div[3]/div/div/input""")
codefill.clear()
codefill.send_keys(trycode)
To find the element, clear, then enter the code variable. I keep receiving the following error:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="app-mount"]/div[1]/div/div[2]/div/form/div/div[3]/div/div/input"}
(Session info: chrome=79.0.3945.130)
Any idea how I can fix this or what I am doing wrong? Thanks :)