def wait_for_page_change(browser, source_url=None, page_source=None, wait_time=0.1, max_retries=50):
 for i in range(max_retries):
  if ((source_url is not None) and (browser.current_url != source_url)):
   break
  elif ((page_source is not None) and (browser.page_source != page_source)):
   break
  else:
   time.sleep(wait_time)
 return (browser.current_url != source_url)

def wait_for_page_change ( browser , source_url = None , page_source = None , wait_time = 0.1 , max_retries = 50 ) : for i in range ( max_retries ) : if ( ( source_url is not None ) and ( browser . current_url != source_url ) ) : break elif ( ( page_source is not None ) and ( browser . page_source != page_source ) ) : break else : time . sleep ( wait_time ) return ( browser . current_url != source_url )
given a selenium browser .