[Fixed]-Time format on Python tests

1👍

You are literally comparing the string that is supposed to be time format with the date itself; can’t do that. You can use regular expressions. Something like this:

text = driver.find_element_by_xpath("//td[3]").text
pattern = re.compile(r"((1?\d)|2[0-4]):[1-5]?\d ~ ((1?\d)|2[0-4]):[1-5]?\d")
self.assertRegexpMatches(text, pattern, "Date format not correct")
👤Amadan

Leave a comment