setup_confirmation.py 734 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env python3
  2. """Prepare the confirmation argument 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(By.CSS_SELECTOR, '[title="Delete old backups"]').click()
  13. _wait_for_body_attr(driver, "loaded-argument-form")
  14. WebDriverWait(driver, 15).until(
  15. lambda d: not d.find_element(By.CSS_SELECTOR, 'button[name="start"]').is_enabled()
  16. )
  17. time.sleep(0.2)