selenium命令三種類型:action(操作)、accessor(存儲)、assertion(斷言)
1、Accessor命令:
store(expression,variableName)-將指定的值存儲在變量中
storeTitle(variableName)-用於存放當前網頁的標題
storeLocation(variableName)-用於存儲當前網頁的url
storeValue(locator,variableName)-用於存儲input元素所存放的值(on/off)
storeEditable(locator,variableName)-用於存儲input元素的可編輯狀態
storeText(locator,variableName)-用於存儲某個元素的文本值
storeChecked(locator,variableName)-存儲複選框或單選框的勾選情況(true/false)
storeSelectedIndex(SelectLocator,variableName)-獲取所選項在列表中的索引
storeSelectedLable(SelectLocator,variableName)-獲選指定列表中所選項的文本值
storeSelectedValue(SelectLocator,variableName)-獲選指定列表中所選項的真實值(value屬性)
storeSelectedOptions(SelectLocator,variableName)-獲選指定列表中所有選項的文本
storeTable(tableCellAddress,variableName)-獲取表格中某個單元格的值(target格式:表格的定位
表達式.行號.列號)
storeAttribute(attributeLocator,variableName)-獲取指定屬性的值(target格式:元素定位表達式+@屬性名稱)
storeTextPresent(pattern,variableName)-驗證指定的文本是否在頁面中出現(true/false)
storeElementPresent(locator,variableName)-驗證指定元素是否在頁面中出現
storeVisible(locator,variableName)-驗證頁面上看不到的元素是否在頁面中出現
storeSpeed(variableName)-獲取執行速度
閱讀更多 避風港的輕音樂23 的文章