diff options
| author | Teddy Wing | 2018-02-04 04:45:25 +0100 |
|---|---|---|
| committer | Teddy Wing | 2018-02-04 04:45:25 +0100 |
| commit | 3ee6bbd1e5a2afdca3532e83880300d123bc9294 (patch) | |
| tree | 008a77f28612c227f0f1a7a525a705d20e7e20bc /harvester_submit_week_for_approval.py | |
| parent | 4e1c150d18a85fe386615489ebaa6a327ec23cf3 (diff) | |
| download | harvester-submit-week-for-approval-3ee6bbd1e5a2afdca3532e83880300d123bc9294.tar.bz2 | |
submit_week_for_approval: Fix date page load check
This time the test for page load using the `friday` date didn't work.
Not sure why, it should be the same and the text and element looks
right. The only thing I can think of is that Selenium isn't smart enough
to know there are multiple elements with the same class name and so it
was comparing the wrong one, and last time when it worked it was just a
fluke that happened to work the first time.
Replace the CSS selector with an XPath selector that will get a "unique"
element for us and still check that the correct date appears (here,
formatted as "Wednesday, 24 January").
Diffstat (limited to 'harvester_submit_week_for_approval.py')
| -rw-r--r-- | harvester_submit_week_for_approval.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/harvester_submit_week_for_approval.py b/harvester_submit_week_for_approval.py index a0c937e..5939af4 100644 --- a/harvester_submit_week_for_approval.py +++ b/harvester_submit_week_for_approval.py @@ -51,9 +51,11 @@ def submit_week_for_approval(driver, wait, subdomain): 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'))) + wait.until(expected.visibility_of_element_located( + ( + By.XPATH, + '//a[@aria-label="{}"]'.format(friday.strftime('%A, %d %B')) + ))) # Click "Submit Week for Approval" button driver.find_element_by_css_selector( |
