setup_checklist.py 809 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python3
  2. """Prepare the checklist argument form screenshot."""
  3. import time
  4. from selenium.webdriver.common.by import By
  5. from selenium.webdriver.support.ui import WebDriverWait
  6. def _wait_for_body_attr(driver, attr, timeout=15):
  7. WebDriverWait(driver, timeout).until(
  8. lambda d: bool(d.find_element(By.TAG_NAME, "body").get_attribute(attr))
  9. )
  10. def run(driver):
  11. _wait_for_body_attr(driver, "loaded-dashboard")
  12. driver.find_element(
  13. By.CSS_SELECTOR, '[title="Backup selected directories"]'
  14. ).click()
  15. _wait_for_body_attr(driver, "loaded-argument-form")
  16. WebDriverWait(driver, 15).until(
  17. lambda d: len(
  18. d.find_elements(By.CSS_SELECTOR, ".choice-checklist-item input[type='checkbox']")
  19. )
  20. >= 3
  21. )
  22. time.sleep(0.2)