From 3ee6bbd1e5a2afdca3532e83880300d123bc9294 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 4 Feb 2018 04:45:25 +0100 Subject: 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"). --- harvester_submit_week_for_approval.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'harvester_submit_week_for_approval.py') 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( -- cgit v1.2.3