def _autocomple_finish(el_id, browser):
 giveup = 0.0
 sleeptime = 0.2
 el = browser.find_element_by_id(el_id)
 while (giveup < 60):
  try:
   if (el.find_elements_by_tag_name('option')[0].text != ''):
    return
  except:
   print ('StaleElementReferenceException %s' % giveup)
   el = browser.find_element_by_id(el_id)
  time.sleep(sleeptime)
  giveup += sleeptime

def _autocomple_finish ( el_id , browser ) : giveup = 0.0 sleeptime = 0.2 el = browser . find_element_by_id ( el_id ) while ( giveup < 60 ) : try : if ( el . find_elements_by_tag_name ( 'option' ) [ 0 ] . text != '' ) : return except : print ( 'StaleElementReferenceException %s' % giveup ) el = browser . find_element_by_id ( el_id ) time . sleep ( sleeptime ) giveup += sleeptime
helper function .