def wait_for_logs(self): old_length = -1 elements = self.find("#" + LOG_DIV + " p") while len(elements) != old_length: Thread.sleep(seconds=10) old_length = len(elements) elements = self.find("#" + LOG_DIV + " p") return [ CNV.JSON2object(CNV.html2unicode(e.get_attribute('innerHTML'))) for e in elements ]
def wait_for_logs(self, timeout=None): if not timeout: timeout = timedelta(seconds=10) def logs(): return self.find("#" + LOG_DIV + " p") def status(): s = self.find("#status") if not s: return None return s[0].text # IF THE MESSAGE KEEPS CHANGING OR THE LOGS KEEP INCREASING WE CAN BE # CONFIDENT SOMETHING IMPORTANT IS STILL HAPPENING self._wait_for_stable(lambda: (status(), len(logs())), timeout) output = [ CNV.JSON2object(CNV.html2unicode(e.get_attribute('innerHTML'))) for e in logs() ] Log.note("Logs:\n{{logs|indent}}", {"logs": output}) return output