菜鳥學自動化測試(三)----selenium 命令(2)

發表于:2012-01-10來源:博客園作者:蟲師點擊數: 標簽:selenium
waitForValue waitForValue(inputLocator, value) - 等待某input(如hidden input)被賦予某值, - 會輪流檢測該值,所以要注意如果該值長時間一直不賦予該input該值的話,可

  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

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97