diff options
Diffstat (limited to 'harvester_submit_week_for_approval.py')
| -rw-r--r-- | harvester_submit_week_for_approval.py | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/harvester_submit_week_for_approval.py b/harvester_submit_week_for_approval.py index 9c92e74..4b2bc6a 100644 --- a/harvester_submit_week_for_approval.py +++ b/harvester_submit_week_for_approval.py @@ -50,32 +50,34 @@ def submit_week_for_approval(driver, wait): driver.get(url) # Wait for page to load - print(driver.find_element_by_id('days-in-week-data-island')) - print(driver.find_element_by_id('days-in-week-data-island').get_attribute('innerHTML')) + wait.until(expected.text_to_be_present_in_element( + (By.CLASS_NAME, 'timesheet-header'), + str(friday.year))) + wait.until(expected.text_to_be_present_in_element( + (By.CSS_SELECTOR, '.day .js-day'), + friday.strftime('%d %b'))) + + # Click "Submit Week for Approval" button + driver.find_element_by_css_selector( + '.approval-button .submit-link' + ).click() + + # Click "Yes, Submit Timesheet" button + wait.until( + expected.visibility_of_element_located( + ( + By.CSS_SELECTOR, + '.approval-confirmation .js-submit-for-approval', + ) + ) + ).click() + + # Wait for success message + wait.until(expected.text_to_be_present_in_element( + (By.ID, 'status_message'), + 'Timesheet has been submitted for approval.')) + return driver - # wait.until(expected.text_to_be_present_in_element( - # (By.ID, 'days-in-week-data-island'), - # friday.strftime('%F'))) - - # # Click "Submit Week for Approval" button - # driver.find_element_by_css_selector( - # '.approval-button .submit-link' - # ).click() - # - # # Click "Yes, Submit Timesheet" button - # wait.until( - # expected.visibility_of_element_located( - # ( - # By.CSS_SELECTOR, - # '.approval-confirmation .js-submit-for-approval', - # ))) - # - # # Wait for success message - # wait.until(expected.text_to_be_present_in_element( - # (By.ID, 'status_message'), - # 'Timesheet has been submitted for approval.')) - # - # return driver if __name__ == "__main__": options = Options() |
