場景分析:

上圖“通用模版測試”內容
滿足,如果當前頁面存在這條數據,即結束執行本條用例,自動執行下一條。如果沒有,則調用新建模版關鍵字,執行新建模版。
腳本如下

1配置運費模版
[Documentation] 依賴腳本:登錄后台
click link link=設置 #點擊設置模塊進入設置模塊
click element id=stnav-151 #切換到運費模版
sleep 2
${a} Run Keyword And Return Status Page Should Contain 通用模版測試
run keyword if ${a} ==${TRUE} log 運費模版添加成功
... ELSE 新建運費模版
這里用到了“Run Keyword And Return Status”和“Page Should Contain”指令
“Page Should Contain”的作用是,檢查當前頁是否有“通用模版測試”這條數據
“Run Keyword And Return Status”的作用是,獲取“Page Should Contain”的返回值(只有true和false,要么存在“通用模版測試”,要么不存在)
然后使用run keyword if ,如果${a} ==${TRUE} 即“Page Should Contain”檢查到“通用模版測試”存在,輸出log
不存在,即“Page Should Contain”沒有檢查到“通用模版測試”,返回值${a} ==${false} ,ELSE則會執行新建模版
