fdutils/selenium_util/decorators.py
def path(expected_path):
    """ decorator to get to the relative page given and check that we have landed on it 
        before calling the decorated function

    :param expected_path:
    :return:
    """
    def get_final_path(websvc):
        new_path = websvc.url

        if expected_path[0] != '/' and websvc.url[-1] != '/':
            return new_path + '/' + expected_path
        return new_path + expected_path

    def deco(f):
        @functools.wraps(f)
        def w(sel_util, *args, **kwargs):

            final_path = get_final_path(sel_util)

            sel_util.open_url(final_path)

            if sel_util.driver.current_url != final_path:
                raise Exception('Wrong current path (expected= {}  - current= {})!!!'
                                ''.format(final_path, sel_util.driver.current_url))
            else:
                return f(sel_util, *args, **kwargs)
        return w

    return deco
 decorator to get to the relative page given and check that we have landed on it 
        before calling the decorated function

    :param expected_path:
    :return:
    
decorator to get to the relative page given and check that we have landed on it
before calling the decorated function
decorator to get to the relative page given and check that we have landed on it before calling the decorated function
def path(expected_path):
    def get_final_path(websvc):
        new_path = websvc.url
        if expected_path[0] != '/' and websvc.url[-1] != '/':
            return new_path + '/' + expected_path
        return new_path + expected_path
    def deco(f):
        @functools.wraps(f)
        def w(sel_util, *args, **kwargs):
            final_path = get_final_path(sel_util)
            sel_util.open_url(final_path)
            if sel_util.driver.current_url != final_path:
                raise Exception('Wrong current path (expected= {}  - current= {})!!!'
                                ''.format(final_path, sel_util.driver.current_url))
            else:
                return f(sel_util, *args, **kwargs)
        return w
    return deco
def path ( expected_path ) : def get_final_path ( websvc ) : new_path = websvc . url if expected_path [ 0 ] != '/' and websvc . url [ - 1 ] != '/' : return new_path + '/' + expected_path return new_path + expected_path def deco ( f ) : @ functools . wraps ( f ) def w ( sel_util , * args , ** kwargs ) : final_path = get_final_path ( sel_util ) sel_util . open_url ( final_path ) if sel_util . driver . current_url != final_path : raise Exception ( 'Wrong current path (expected= {}  - current= {})!!!' '' . format ( final_path , sel_util . driver . current_url ) ) else : return f ( sel_util , * args , ** kwargs ) return w return deco
decorator to get to the relative page given and check that we have landed on it
before calling the decorated function
decorator to get to the relative page given and check that we have landed on it before calling the decorated function
""" decorator to get to the relative page given and check that we have landed on it 
        before calling the decorated function

    :param expected_path:
    :return:
    """
None
expected_path
None