def SeleniumAction(f):
 @functools.wraps(f)
 def Decorator(*args, **kwargs):
  delay = 0.2
  num_attempts = 15
  cur_attempt = 0
  while True:
   try:
    return f(*args, **kwargs)
   except exceptions.WebDriverException as e:
    logging.warn('Selenium raised %s', utils.SmartUnicode(e))
    cur_attempt += 1
    if (cur_attempt == num_attempts):
     raise
    time.sleep(delay)
 return Decorator

def SeleniumAction ( f ) : @ functools . wraps ( f ) def Decorator ( * args , ** kwargs ) : delay = 0.2 num_attempts = 15 cur_attempt = 0 while True : try : return f ( * args , ** kwargs ) except exceptions . WebDriverException as e : logging . warn ( 'Selenium raised %s' , utils . SmartUnicode ( e ) ) cur_attempt += 1 if ( cur_attempt == num_attempts ) : raise time . sleep ( delay ) return Decorator
decorator to do multiple attempts in case of webdriverexception .