diff options
| author | Teddy Wing | 2018-02-04 02:10:24 +0100 |
|---|---|---|
| committer | Teddy Wing | 2018-02-04 02:10:24 +0100 |
| commit | b289678fba194fc8f26b244724bc93ff99fe06de (patch) | |
| tree | 744a8ced5421c787d07c86aa6b51e0595f671c31 | |
| parent | fd81ef677884048630853f348aa9c19a1c0dd2cb (diff) | |
| download | harvester-submit-week-for-approval-b289678fba194fc8f26b244724bc93ff99fe06de.tar.bz2 | |
Replace the sleep with a `wait`
Wait until an element from the logged-in page is found before finishing
or moving on from login.
| -rw-r--r-- | harvester_submit_week_for_approval.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/harvester_submit_week_for_approval.py b/harvester_submit_week_for_approval.py index 1338e2e..586cc4f 100644 --- a/harvester_submit_week_for_approval.py +++ b/harvester_submit_week_for_approval.py @@ -21,6 +21,10 @@ def login(driver): ).send_keys(email) driver.find_element_by_name('password').send_keys(password + Keys.ENTER) + wait.until( + expected.visibility_of_element_located((By.ID, 'user-dropdown-toggle')) + ) + return driver if __name__ == "__main__": @@ -35,5 +39,5 @@ if __name__ == "__main__": print(driver.page_source) - import time; time.sleep(20) + # import time; time.sleep(20) driver.quit() |
