I've been trying to create a bot that logs into facebook.com for me using the following tutorial: https://medium.com/@kikigulab/how-to-automate-opening-and-login-to-websites-with-python-6aeaf1f6ae98
However, I can't get my bot to click the "Login" button because the ID of Facebook's "Login" button keeps changing (I found this out by right clicking the "Login" button, then inspecting element in Chrome). I suppose they do this to prevent spammers, but how can I log into facebook.com or find a workaround for my problem?
For instance, the ID would be "u_0_d_KK" for one refresh of facebook.com, but change to some other string as soon as a new instance of the website is loaded.
Using the code in the link above, my code would look like this but fail:
def login(url, usernameId, username, passwordId, password, submit_buttonId):
driver.get(url)
driver.find_element_by_id(usernameId).send_keys(username)
driver.find_element_by_id(passwordId).send_keys(password)
driver.find_element_by_id(submit_buttonId).click()
login("https://www.facebook.com/", "email", myFbEmail, "pass", myFbPassword, "u_0_d_KK")
since "u_0_d_KK" would actually be some other string upon loading the website.
Thanks in advance!