def u2_get_ui_obj(d, resourceId=None, resourceIdMatches=None, text=None,
    textContains=None, textMatches=None, textStartsWith=None, className=
    None, classNameMatches=None, description=None, descriptionContains=None,
    descriptionMatches=None, descriptionStartsWith=None, packageName=None,
    packageNameMatches=None, checkable: bool=False, checked: bool=False,
    clickable: bool=False, longClickable: bool=False, scrollable: bool=
    False, enabled: bool=False, focusable: bool=False, focused: bool=False,
    selected: bool=False, index: int=0, instance: int=0):
    """
    u2获取指定UI元素对象(因为用u2编码时没有参数提示)
        note: (参数默认值可从 from uiautomator2.session import Selector查看)
    :return: UiObject (from uiautomator2.session import UiObject) eg: ele: UiObject = u2_get_ui_obj(d=d, resourceId='xxxx') 来调用后续方法
    """
    kwargs = {}
    if resourceId is not None:
        kwargs.update({'resourceId': resourceId})
    if resourceIdMatches is not None:
        kwargs.update({'resourceIdMatches': resourceIdMatches})
    if text is not None:
        kwargs.update({'text': text})
    if textContains is not None:
        kwargs.update({'textContains': textContains})
    if textMatches is not None:
        kwargs.update({'textMatches': textMatches})
    if textStartsWith is not None:
        kwargs.update({'textStartsWith': textStartsWith})
    if className is not None:
        kwargs.update({'className': className})
    if classNameMatches is not None:
        kwargs.update({'classNameMatches': classNameMatches})
    if description is not None:
        kwargs.update({'description': description})
    if descriptionContains is not None:
        kwargs.update({'descriptionContains': descriptionContains})
    if descriptionMatches is not None:
        kwargs.update({'descriptionMatches': descriptionMatches})
    if descriptionStartsWith is not None:
        kwargs.update({'descriptionStartsWith': descriptionStartsWith})
    if packageName is not None:
        kwargs.update({'packageName': packageName})
    if packageNameMatches is not None:
        kwargs.update({'packageNameMatches': packageNameMatches})
    if checkable:
        kwargs.update({'checkable': checkable})
    if checked:
        kwargs.update({'checked': checked})
    if clickable:
        kwargs.update({'clickable': clickable})
    if longClickable:
        kwargs.update({'longClickable': longClickable})
    if scrollable:
        kwargs.update({'scrollable': scrollable})
    if enabled:
        kwargs.update({'enabled': enabled})
    if focusable:
        kwargs.update({'focusable': focusable})
    if focused:
        kwargs.update({'focused': focused})
    if selected:
        kwargs.update({'selected': selected})
    if index != 0:
        kwargs.update({'index': index})
    if instance != 0:
        kwargs.update({'instance': instance})
    return d(**kwargs)
