Merhabar arkadaşlar. Bir kod yazıyorum ancak çok saçma bir sıkıntı yaşıyorum.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait



class TwitterBot():
    
    def __init__(self):
        self.driver = webdriver.Chrome()



    def login(self):

        self.driver.get('https://twitter.com/')
        sleep(2)


        sign_in = self.driver.find_element_by_xpath('//*[@id="react-root"]/div/div/div/main/div/div/div/div[1]/div/a[2]/div')
        sign_in.click()

        username = self.driver.find_element_by_xpath('//*[@id="react-root"]/div/div/div[1]/main/div/div/form/div/div[1]/label/div[2]/div/input')
        username.send_keys('xxxxxx')

        password = self.driver.find_element_by_name('//*[@id="react-root"]/div/div/div[1]/main/div/div/form/div/div[2]/label/div[2]/div/input')
        password.send_keys('xxxxxxx')

        sleep(2)


fb = TwitterBot()
fb.login()
Kodum bu. Python consoleda denediğim zaman sıkıntısız işlem yaptırabiliyorum. Ancak kodu çalıştırdığım zaman hata alıyorum.Şöyle diyor.

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="react-root"]/div/div/div[1]/main/div/div/form/div/div[1]/label/div[2]/div/input"}
Dediğim gibi python consoledan deneme yaptığım da username ve password kısmını doldurabiliyorum.