I've been trying since yesterday in Python, with Selenium, to create a bot that allows me to vote on a poll. The process from logging in to voting does it perfectly, but when I indicate the xPath of the option to vote, it doesn't detect it and the bot closes. I tried to externalize the framework in another tab, but on the one hand we have the same error, and on the other, apparently the survey works for Tokens, that is, even if it is accessed from the same user, the link to the framework expires when it is accessed. closes and opens again.
I leave you the extract of the code where I get the error in case someone can enlighten me a bit. All the best.
#Bot entra a encuesta
#entrar encuesta
driver.get("https://twitter.com/majeflomon/status/988357553007550465")
print("----Accediendo a encuesta")
time.sleep(2)
#votar encuesta
button_opc = driver.find_element_by_xpath("/html/body/div/div/div/div/div[2]/label/span[2]")
button_opc.click()
print("----Opcion Marcada (NO)")
#enviar voto
button_env = driver.find_element_by_xpath("/html/body/div/div/div/div/div[4]/div/span[1]")
button_env.click()
print("----Votacion Realizada")
Looking for surveys of that same user, I have seen that the surveys are on an iframe. Therefore you must first switch to the iframe containing the survey: