def _shown_elem_with_wait(context, by, wait_time=MAX_WAIT_TIME):
 def _visibility():
  try:
   elem = context.browser.find_element(by[0], by[1])
   context.browser.execute_script(('$(window).scrollLeft(%s);$(window).scrollTop(%s);' % (elem.location['x'], elem.location['y'])))
   return elem.is_displayed()
  except NoSuchElementException:
   return False
 try:
  return WebDriverWait(context.browser, wait_time).until((lambda browser: _visibility()))
 except TimeoutException:
  return None

def _shown_elem_with_wait ( context , by , wait_time = MAX_WAIT_TIME ) : def _visibility ( ) : try : elem = context . browser . find_element ( by [ 0 ] , by [ 1 ] ) context . browser . execute_script ( ( '$(window).scrollLeft(%s);$(window).scrollTop(%s);' % ( elem . location [ 'x' ] , elem . location [ 'y' ] ) ) ) return elem . is_displayed ( ) except NoSuchElementException : return False try : return WebDriverWait ( context . browser , wait_time ) . until ( ( lambda browser : _visibility ( ) ) ) except TimeoutException : return None
tries to find an element with an explicit timeout .