Exemplo n.º 1
0
 def _isNotExist(self, action):
     '''
     :param action:
     :return:
     '''
     parms = self._getParms(action, 0)
     if not re.match(
             r'^(id|name|class|tag_name|link_text|partial_link_text|xpath|css_selector)\s*=.+',
             parms.strip(), re.I):
         raise TypeError('input parameter format error:{}'.format(parms))
     key = parms.strip().split('=', 1)[0]
     value = parms.strip().split('=', 1)[-1]
     elements = DriverBaseWeb.get_elements(key, value, 0)
     return not bool(elements)
Exemplo n.º 2
0
 def _getElements(self, action):
     '''
     :param action:
     :return:
     '''
     parms = self._getParms(action, 0)
     if not re.match(
             r'^(id|name|class|tag_name|link_text|partial_link_text|xpath|css_selector)\s*=.+',
             parms.strip(), re.I):
         raise TypeError('input parameter format error:{}'.format(parms))
     key = parms.strip().split('=', 1)[0]
     value = parms.strip().split('=', 1)[-1]
     elements = DriverBaseWeb.get_elements(key, value, Var.time_out)
     if not elements:
         raise Exception("Can't find elements: {}".format(parms))
     return elements