waitForValue
waitForValue(inputLocator, value)
- 等待某input(如hidden input)被賦予某值,
- 會輪流檢測該值,所以要注意如果該值長時間一直不賦予該input該值的話,可能會導致阻塞waitForValue | finishIndication | isfinished |
store,stroreValue
store(valueToStore, variablename)
保存一個值到變量里。
該值可以由自其他變量組合而成或通過JavaScript表達式賦值給變量store | Mr John Smith | fullname |
store | $.{title} $.{firstname} $.{suname} | fullname |
store | javascript.{Math.round(Math.PI*100)/100} | PI |
storeValue | inputLocator | variableName |
把指定的input中的值保存到變量中
storeValue | userName | userID |
type | userName | $.{userID} |
storeText, storeAttribute
storeText(elementLocator, variablename)
把指定元素的文本值賦予給變量storeText | currentDate | expectedStartDate |
verifyValue | startDate | $.{expectedStartDate} |
storeAttribute(.{}elementLocator@attributeName,variableName.{})
把指定元素的屬性的值賦予給變量
storeAttribute | input1@class | classOfInput1 |
verifyAttribute | input2@class | $.{classOfInput1} |
chooseCancel.., answer..
chooseCancelOnNextConfirmation()
- 當下次JavaScript彈出confirm對話框的時候,讓selenium選擇Cancel
- 如果沒有該命令時,遇到confirm對話框Selenium默認返回true,如手動選擇OK按鈕一樣chooseCancelOnNextConfirmation |
- 如果已經運行過該命令,當下一次又有confirm對話框出現時,也會同樣地再次選擇Cancel
原文轉自:http://www.anti-gravitydesign.com