Ejemplo n.º 1
0
    def check_tag(self, tag_name, value=True):
        li = self.get_li(text=tag_name)
        cl = li.get_attr('class')
        state = 'tc-categories__item_active' in cl

        if value != state:
            a = LinkElement(self.s)
            a.parent = li
            a.click()
Ejemplo n.º 2
0
    def __init__(self, session, ng_model=None, _id=None, name=None,
                 attrs=None, cls='select2-container', tag='div', xp_pref='//'):
        if ng_model is not None:
            if attrs is None:
                attrs = dict()

            attrs['ng-model'] = ng_model

        self._main_lnk = LinkElement(session)
        self._main_lnk.parent = self

        self._ulist = ULElement(session, tag='ul//ul')
        self._ulist.parent = self

        super().__init__(session, tag, cls, _id, name, attrs, xp_pref='//')
Ejemplo n.º 3
0
class TCDropDownList(Element):
    def __init__(self, session, ng_model=None, _id=None, name=None,
                 attrs=None, cls='select2-container', tag='div', xp_pref='//'):
        if ng_model is not None:
            if attrs is None:
                attrs = dict()

            attrs['ng-model'] = ng_model

        self._main_lnk = LinkElement(session)
        self._main_lnk.parent = self

        self._ulist = ULElement(session, tag='ul//ul')
        self._ulist.parent = self

        super().__init__(session, tag, cls, _id, name, attrs, xp_pref='//')

    def set_value(self, value):
        self._main_lnk.click()
        li = self._ulist.get_li(text=value)
        li.click()

    def value(self):
        return self._main_lnk.text()