page_main.py 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. from selenium.webdriver.support import expected_conditions as EC
  2. from selenium.webdriver.common.by import By
  3. class page_main():
  4. item_purple_circle_xpath = "//*[@id='__next']/div/div[3]/div[1]/div[3]/div/div/div"
  5. button_sign_yourself_id = "Task-AddTask-SignYourself"
  6. tab_completed_xpath = "//*[@id='__next']/div/div[2]/div/div[3]/div[1]"
  7. option_latest_task_xpath = "//*[@id='__next']/div/div[3]/div[1]/div[2]/div/div[1]/div[1]"
  8. def __init__(self,driver,wait):
  9. self.driver = driver
  10. self.wait = wait
  11. def wait_purple_circle(self):
  12. self.wait.until(EC.element_to_be_clickable((By.XPATH, self.item_purple_circle_xpath)))
  13. def click_purple_circle(self):
  14. self.driver.find_element_by_xpath(self.item_purple_circle_xpath).click()
  15. def wait_sign_yourself_button(self):
  16. self.wait.until(EC.element_to_be_clickable((By.ID, self.button_sign_yourself_id)))
  17. def click_sign_yourself_button(self):
  18. self.driver.find_element_by_id(self.button_sign_yourself_id).click()
  19. def wait_completed_tab(self):
  20. self.wait.until(EC.element_to_be_clickable((By.XPATH, self.tab_completed_xpath)))
  21. def click_completed_tab(self):
  22. self.driver.find_element_by_xpath(self.tab_completed_xpath).click()
  23. def wait_latest_task_option(self):
  24. self.wait.until(EC.element_to_be_clickable((By.XPATH, self.option_latest_task_xpath)))
  25. def click_latest_task_option(self):
  26. self.driver.find_element_by_xpath(self.option_latest_task_xpath).click()