def switch_to_frame(driver, frame, timeout=settings.SMALL_TIMEOUT):
    """
    Wait for an iframe to appear, and switch to it. This should be usable
    as a drop-in replacement for driver.switch_to.frame().
    @Params
    driver - the webdriver object (required)
    frame - the frame element, name, or index
    timeout - the time to wait for the alert in seconds
    """

    start_ms = time.time() * 1000.0
    stop_ms = start_ms + (timeout * 1000.0)
    for x in range(int(timeout * 10)):
        try:
            driver.switch_to.frame(frame)
            return True
        except NoSuchFrameException:
            now_ms = time.time() * 1000.0
            if now_ms >= stop_ms:
                break
            time.sleep(0.1)
    raise Exception("Frame was not present after %s seconds!" % timeout)
def switch_to_frame ( driver , frame , timeout = settings . SMALL_TIMEOUT ) : start_ms = time . time ( ) * 1000.0 stop_ms = start_ms + ( timeout * 1000.0 ) for x in range ( int ( timeout * 10 ) ) : try : driver . switch_to . frame ( frame ) return True except NoSuchFrameException : now_ms = time . time ( ) * 1000.0 if now_ms >= stop_ms : break time . sleep ( 0.1 ) raise Exception ( "Frame was not present after %s seconds!" % timeout )
Wait for an iframe to appear, and switch to it. This should be usable
    as a drop-in replacement for driver.switch_to.frame().
    @Params
    driver - the webdriver object (required)
    frame - the frame element, name, or index
    timeout - the time to wait for the alert in seconds