def wait_for_element_present(driver, selector, by=By.CSS_SELECTOR,<EOL>timeout=settings.LARGE_TIMEOUT):
element = None<EOL>start_ms = time.time() * <NUM_LIT><EOL>stop_ms = start_ms + (timeout * <NUM_LIT>)<EOL>for x in range(int(timeout * <NUM_LIT:10>)):<EOL><INDENT>try:<EOL><INDENT>element = driver.find_element(by=by, value=selector)<EOL>return element<EOL><DEDENT>except Exception:<EOL><INDENT>now_ms = time.time() * <NUM_LIT><EOL>if now_ms >= stop_ms:<EOL><INDENT>break<EOL><DEDENT>time.sleep(<NUM_LIT:0.1>)<EOL><DEDENT><DEDENT>if not element:<EOL><INDENT>raise NoSuchElementException(<EOL>"<STR_LIT>" % (<EOL>selector, timeout))<EOL><DEDENT>
Searches for the specified element by the given selector. Returns the
element object if the element is present on the page. The element can be
invisible. Raises an exception if the element does not appear in the
specified timeout.
@Params
driver - the webdriver object
selector - the locator that is used (required)
by - the method to search for the locator (Default: By.CSS_SELECTOR)
timeout - the time to wait for elements in seconds
@Returns
A web element object