def wait_for_condition_else_raise(marionette, wait_for_condition, expected,
                                  script):
    try:
        wait_for_condition(lambda m: expected in m.execute_script(script))
    except TimeoutException as e:
        raise TimeoutException("{0} got {1} instead of {2}".format(
            e.message, marionette.execute_script(script), expected))
def wait_for_condition_else_raise(marionette, wait_for_condition, expected,
                                  script):
    try:
        wait_for_condition(lambda m: expected in m.execute_script(script))
    except TimeoutException as e:
        raise TimeoutException(e.msg + " got %s instead of %s" %
                               (marionette.execute_script(script), expected))
Example #3
0
 def wait_for_condition(self, method, timeout=30):
     timeout = float(timeout) + time.time()
     while time.time() < timeout:
         value = method(self.marionette)
         if value:
             return value
         time.sleep(0.5)
     else:
         raise TimeoutException("wait_for_condition timed out")