#eposta giris.
e_posta = browser.find_element( By.NAME,"username")
e_posta.send_keys(acc_email)
time.sleep(2)
#ileri git basar.
ileri_git = browser.find_element(By.XPATH, "//*[@id='__next']/main/main/section/div/div/form/button/span[1]")
ileri_git.click()
time.sleep(1)
#sifre giris.
sifre = browser.find_element( By.NAME,"new-password")
sifre.send_keys(acc_sifre)
time.sleep(2)
#iler git basar.
ileri = browser.find_element(By.XPATH, "//*[@id='__next']/main/main/section/div/div/section/form/div[2]/button/span[1]")
ileri.click()
time.sleep(2)
#nick yazar.
kullanici_adi = browser.find_element( By.NAME,"displayName")
kullanici_adi.send_keys(generate_random_name(length=8))
time.sleep(2)
#gün oluşturur.
day = browser.find_element( By.NAME,"day")
random_day = str(random.randint(1, 29))
day.send_keys(random_day)
time.sleep(2.5)
#ay oluşturur.
random_month_number = random.randint(1, 9)
month_xpath = f"//*[@id='month']/option[{random_month_number}]"
selected_month = browser.find_element(By.XPATH, month_xpath)
selected_month.click()
time.sleep(2)
year = browser.find_element( By.NAME,"year")
random_year = str(random.randint(1950,2000))
year.send_keys(random_year)
time.sleep(3)
# Rastgele bir sayı seç (1 ile 3 arasında)
random_number = random.randint(1, 3)
# Yeni XPath ifadesini oluştur.
new_xpath = "//*[@id='__next']/main/main/section/div/div/section/form/div[1]/section/div[3]/fieldset/div/div/div[{}]/label/span[2]".format(random_number)
# Cinsiyeti seç.
cinsiyet = browser.find_element(By.XPATH, new_xpath)
cinsiyet.click()
time.sleep(4)
#ileri butonuna bas.
ileri_2 = browser.find_element(By.XPATH, "//*[@id='__next']/main/main/section/div/div/section/form/div[2]/button/span[1]")
ileri_2.click()
time.sleep(10)
#sozlesmeyı onaylar.
sozlesme=browser.find_element(By.XPATH, "//*[@id='__next']/main/main/section/div/div/section/form/div[1]/section/div[4]/div[2]/div/label/span[1]")
sozlesme.click()
time.sleep(4)
#ve bitir...
tamamla= browser.find_element(By.XPATH,"//*[@id='__next']/main/main/section/div/div/section/form/div[2]/button/span[1]")
tamamla.click()
time.sleep(8)
url="https://open.spotify.com/user/uhm6ssq9dgz910i5onkqkbjat"
browser.get(url)
time.sleep(8)
sagtik=browser.find_element(By.XPATH,'/html/body/div[4]/div/div[2]/div[3]/div[1]/div[2]/div[2]/div/div/div[2]/main/section/div/section/div[2]/div[3]/div/div[3]')
time.sleep(2)
actions=ActionChains(browser)
actions.context_click(sagtik).perform()
time.sleep(3)
browser.find_element(By.XPATH,'//*[@id="context-menu"]/ul/li[1]/button/span').click()
print("liste beğenildi")
time.sleep(5)
browser.close()
browser.quit()