from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

firefox_options = Options()

driver = webdriver.Firefox(options=firefox_options)

driver.get("https://journal.top-academy.ru/ru/auth/login/index?returnUrl=%2Fru%2Fmain%2Fdashboard%2Fpage%2Findex")

wait = WebDriverWait(driver, 10)
search_box = wait.until(EC.presence_of_element_located((By.ID, "username")))
search_box.send_keys("")
search_box.submit()
wait1 = WebDriverWait(driver,6)
search_box = wait1.until(EC.presence_of_element_located((By.ID, "password")))
search_box.send_keys("")
search_box.submit()
searchbox = driver.find_element(By.XPATH,"/html/body/mystat/ng-component/ng-component/section/div/div/div/div/div[1]/tabset/div/tab[1]/form/button")
searchbox.click()
print("Успешно")
searchbox = wait1.until(EC.presence_of_element_located((By.XPATH,"//a[@href='https://journal.top-academy.ru/ru/main/homework/page']")))
searchbox.click()
searchbox = driver.find_element(By.XPATH,"/html/body/mystat/ng-component/ng-component/div/div[3]/div[2]/ng-component/div/div[2]/hw-item[1]/div/div[1]/div/div[4]/div[1]/a")
searchbox.click()
    
# driver.quit()