上傳文件
choose file
用法:choose file 元素定位 文件路徑\\文件名
此處注意:復制的路徑是/,需全部替換成\\
清除
Clear Element Text
用於輸入框輸入前的清除
取文本值
get text
取值
get value
鼠標懸浮
Mouse Over
設置全局變量
Set Global Variable
殺進程(用於解決谷歌無法查看日志問題)taskkill /f /t /im chromedriver.exe
OperatingSystem.Run taskkill /f /t /im chromedriver.exe
type用法
${type} Evaluate type(${name})
log ${type}
取隨機數
${name} Evaluate random.randint(000000,999999) random
取電話號碼
${cellphone} Evaluate random.choice(['139','188','185','136','158','151'])+"".join(random.choice("0123456789") for i in range(8)) random
新增后去數據庫查詢
Connect To Database Using Custom Params pymysql database=庫名, user=用戶名, password=密碼, host=IP, port=端口號
${result} Query (查詢語句)
log ${result[0][0]}
${result1} Set Variable ${result[0][0]}
備注:由於查詢結果返回是list,所以對結果需做相應處理
正則取查詢底部總條數(一般查詢時需獲取底部頁數)
${pageCount} Get Regexp Matches ${value} 共( +(\\d+) +)條 #正則
log ${pageCount[0]}
${pageCount1} Set Variable ${pageCount[0]} #由於返回值是list,所以需要把值取出
log ${pageCount1}
備注(Get Regexp Matches正則表達式是String庫的關鍵字)
string類型轉換為int
關鍵字
Convert To Integer