I'm new to coding. I'am trying to make a twitter bot but when I find XPaths and paste it in my code it gives an error
I tried to find the element with id, name, selector and paste it in my code but none of them worked
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
import time
class TwitterBot:
def __init__(self , username , password) :
self.username = username
self.password = password
chrome_options = Options()
self.bot = webdriver.Chrome(ChromeDriverManager().install() , options = chrome_options)
def login(self):
bot = self.bot
bot.get("https://twitter.com/login")
time.sleep(5)
email = bot.find_element(By.XPATH , '/html[1]/body[1]/div[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[2]/div[2]/div[1]/div[1]/div[2]/div[2]/div[1]/div[1]/div[1]/div[5]/label[1]/div[1]/div[2]/div[1]/input[1]')
email.send_keys(self.username)
f = TwitterBot("blabla" ,"blabla")
f.login()
