def wait_for_exact_text_visible(driver, text, 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>if element.is_displayed() and text.strip() == element.text.strip():<EOL><INDENT>return element<EOL><DEDENT>else:<EOL><INDENT>element = None<EOL>raise Exception()<EOL><DEDENT><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>plural = "<STR_LIT:s>"<EOL>if timeout == <NUM_LIT:1>:<EOL><INDENT>plural = "<STR_LIT>"<EOL><DEDENT>if not element:<EOL><INDENT>raise ElementNotVisibleException(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (text, selector, timeout, plural))<EOL><DEDENT>
Searches for the specified element by the given selector. Returns the
element object if the text matches exactly with the text in the element,
and the text is visible.
Raises an exception if the text or element do not appear
in the specified timeout.
@Params
driver - the webdriver object (required)
text - the exact text that is expected for the element (required)
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 that contains the text searched for