Exemplo n.º 1
0
 def __set__(self, instance, value):
     if self.has_context:
         raise PageElementError(
             "Sorry, the set descriptor doesn't support elements with context."
         )
     elems = self.__get__(instance, instance.__class__)
     if not elems:
         raise PageElementError("Can't set value, no elements found")
     [elem.send_keys(value) for elem in elems]
Exemplo n.º 2
0
 def __set__(self, instance, value):
     if self.has_context:
         raise PageElementError(
             "Sorry, the set descriptor doesn't support elements with context."
         )
     elem = self.__get__(instance, instance.__class__)
     if not elem:
         raise PageElementError("Can't set value, element not found")
     elem.send_keys(value)
     log.info('输入:{value},method:{method}; value:{selector}'.format(
         value=value, method=self.locator[0], selector=self.locator[1]))
Exemplo n.º 3
0
 def __set__(self, instance, value):
     if self.has_context:
         raise PageElementError(
             "Sorry, the set descriptor doesn't support elements with context."
         )
     elem = self.__get__(instance, instance.__class__)
     if not elem:
         raise PageElementError("Can't set value, element not found")
     elem.click()  # 部分输入框需要重新点击一次,才能清空文本
     sleep(0.3)
     elem.clear()  # 清空文本
     sleep(0.3)
     elem.send_keys(value)