def wait(self, context):
try:
return context.find_element(*self.locator)
except NoSuchElementException:
return None
def find(self, context):
for i in range(self.time_out):
if self.wait(context) is not None:
return self.wait(context)
else:
sleep(1)
else:
return None