填写方法:增加插入随机数的匹配符{r}

使用例子: 填写|id@@kw@@测试随机数{r}随机数结尾
This commit is contained in:
jerrylizilong 2019-03-13 16:45:34 +08:00
parent 51ab1225a1
commit 0d55a46f5a
1 changed files with 10 additions and 1 deletions

View File

@ -195,6 +195,7 @@ class extend():
time.sleep(2)
def fill(self,driver,para_list,text, is_displayed = True):
text = self.replaceRandomValue(text)
element = self.find_element(driver, para_list,is_displayed)
print(len(element))
# element = driver.find_element(by=para_list[0],value=para_list[1])
@ -223,3 +224,11 @@ class extend():
return element.get_attribute('innerText')
else:
return ''
def replaceRandomValue(self,oriValue):
import random
newValue = str(oriValue).replace('{r}',str(random.randint(10000,99999)))
print(oriValue,newValue)
return newValue