I'm trying to log in to twitter with a bot.
self.browser.get('https://www.twitter.com/login')
sleep(20)
username_input = self.browser.find_element(By.XPATH,'//*[@id="react-root"]/div/div/div/main/div/div/div/div[2]/div[2]/div[1]/div/div[5]/label/div/div[2]/div/input')
sleep(20)
username_input.send_keys(username)
sleep(5)
But I keep getting No Such Element error:
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="react-root"]/div/div/div/main/div/div/div/div[2]/div[2]/div[1]/div/div[5]/label/div/div[2]/div/input"}
I copied and pasted the exact Xpath and I can't figure out why it can't find the field.