#NEWLINE# def wait_for_element_not_visible( driver , selector , by = By . CSS_SELECTOR , timeout = settings . LARGE_TIMEOUT ) : #NEWLINE# #INDENT# '\n    Searches for the specified element by the given selector.\n    Raises an exception if the element is still visible after the\n    specified timeout.\n    @Params\n    driver - the webdriver object (required)\n    selector - the locator that is used (required)\n    by - the method to search for the locator (Default: By.CSS_SELECTOR)\n    timeout - the time to wait for the element in seconds\n    ' #NEWLINE# for x in range ( int ( ( timeout * 10 ) ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# element = driver . find_element ( by = by , value = selector ) #NEWLINE# if element . is_displayed ( ) : #NEWLINE# #INDENT# time . sleep ( 0.1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# #UNINDENT# raise Exception ( ( 'Element %s was still visible after %s seconds!' % ( selector , timeout ) ) )