fdutils/selenium_util/locator_utils.py
def parse_selector(t, default_by=None):
    """ simplify defining selectors for find operations by using simple strings

    :param t:
    :return:
    """

    if not isinstance(t, str):
        return t

    t = str(t)

    # By Name
    if t.startswith('name='):
        return By.NAME, t[len('name='):]
    elif t.startswith('n='):
        return By.NAME, t[2:]

    # By CSS
    elif t.startswith('.'):
        return By.CLASS_NAME, t[1:]
    elif t.startswith('css='):
        return By.CSS_SELECTOR, t[4:]
    elif t[0] in ('#', '>', '*', ':', '['):
        return By.CSS_SELECTOR, t
    elif t.startswith('id='):
        return By.ID, t[3:]

    # By Link value
    elif t.startswith('link='):
        return By.LINK_TEXT, t[5:]
    elif t.startswith('plink='):
        return By.PARTIAL_LINK_TEXT, t[6:]
    elif t.startswith('a='):
        return By.LINK_TEXT, t[2:]

    # By XPATH
    elif t.startswith('xp='):
        return By.XPATH, t[3:]
    elif t.startswith('xpath='):
        return By.XPATH, t[6:]
    elif t.startswith('/') or t.startswith('(/'):
        return By.XPATH, t

    # By Tag Name
    elif t.startswith('tag='):
        return By.TAG_NAME, t[4:]
    elif t.startswith('t='):
        return By.TAG_NAME, t[2:]

    elif default_by:
        return default_by, t
    else:
        raise AttributeError('unknown value ({}) to guess selector'.format(t))
 simplify defining selectors for find operations by using simple strings

    :param t:
    :return:
    
simplify defining selectors for find operations by using simple strings
simplify defining selectors for find operations by using simple strings
def parse_selector(t, default_by=None):
    if not isinstance(t, str):
        return t
    t = str(t)
    if t.startswith('name='):
        return By.NAME, t[len('name='):]
    elif t.startswith('n='):
        return By.NAME, t[2:]
    elif t.startswith('.'):
        return By.CLASS_NAME, t[1:]
    elif t.startswith('css='):
        return By.CSS_SELECTOR, t[4:]
    elif t[0] in ('#', '>', '*', ':', '['):
        return By.CSS_SELECTOR, t
    elif t.startswith('id='):
        return By.ID, t[3:]
    elif t.startswith('link='):
        return By.LINK_TEXT, t[5:]
    elif t.startswith('plink='):
        return By.PARTIAL_LINK_TEXT, t[6:]
    elif t.startswith('a='):
        return By.LINK_TEXT, t[2:]
    elif t.startswith('xp='):
        return By.XPATH, t[3:]
    elif t.startswith('xpath='):
        return By.XPATH, t[6:]
    elif t.startswith('/') or t.startswith('(/'):
        return By.XPATH, t
    elif t.startswith('tag='):
        return By.TAG_NAME, t[4:]
    elif t.startswith('t='):
        return By.TAG_NAME, t[2:]
    elif default_by:
        return default_by, t
    else:
        raise AttributeError('unknown value ({}) to guess selector'.format(t))
def parse_selector ( t , default_by = None ) : if not isinstance ( t , str ) : return t t = str ( t ) if t . startswith ( 'name=' ) : return By . NAME , t [ len ( 'name=' ) : ] elif t . startswith ( 'n=' ) : return By . NAME , t [ 2 : ] elif t . startswith ( '.' ) : return By . CLASS_NAME , t [ 1 : ] elif t . startswith ( 'css=' ) : return By . CSS_SELECTOR , t [ 4 : ] elif t [ 0 ] in ( '#' , '>' , '*' , ':' , '[' ) : return By . CSS_SELECTOR , t elif t . startswith ( 'id=' ) : return By . ID , t [ 3 : ] elif t . startswith ( 'link=' ) : return By . LINK_TEXT , t [ 5 : ] elif t . startswith ( 'plink=' ) : return By . PARTIAL_LINK_TEXT , t [ 6 : ] elif t . startswith ( 'a=' ) : return By . LINK_TEXT , t [ 2 : ] elif t . startswith ( 'xp=' ) : return By . XPATH , t [ 3 : ] elif t . startswith ( 'xpath=' ) : return By . XPATH , t [ 6 : ] elif t . startswith ( '/' ) or t . startswith ( '(/' ) : return By . XPATH , t elif t . startswith ( 'tag=' ) : return By . TAG_NAME , t [ 4 : ] elif t . startswith ( 't=' ) : return By . TAG_NAME , t [ 2 : ] elif default_by : return default_by , t else : raise AttributeError ( 'unknown value ({}) to guess selector' . format ( t ) )
simplify defining selectors for find operations by using simple strings
simplify defining selectors for find operations by using simple strings
""" simplify defining selectors for find operations by using simple strings

    :param t:
    :return:
    """ # By Name # By CSS # By Link value # By XPATH # By Tag Name
None
t
None
default_by