您的位置:軟件測試 > 開源軟件測試 > 開源功能測試工具 > Selenium
Selenium命令列表
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時間:[ 2014/3/18 9:38:40 ] 推薦標簽:Selenium 功能測試

一、Commands (命令)

    Action
    對當前狀態(tài)進行操作
    失敗時,停止測試
    Assertion
    校驗是否有產(chǎn)生正確的值
    Element Locators
    指定HTML中的某元素
    Patterns
    用于模式匹配

1.Element Locators (元素定位器)

    id=id
    id locator 指定HTML中的id的元素
    name=name
    name locator指定 HTML中相同name的元素中的第一個元素
    identifier=id
    identifier locator 首先查找HTML是否存在該id的元素, 若不存在,查找第一個該name的元素
    dom=javascriptExpression
    dom locator用JavaScript表達式來定位HTML中的元素,注意必須要以"document"開頭
    例如:
    dom=document.forms['myForm'].myDropdown
    dom=document.images[56]
    xpath=xpathExpression
    xpath locator用 XPath 表達式來定位HTML中的元素,必須注意要以"//"開頭
    例如:
    xpath=//img[@alt='The image alt text']
    xpath=//table[@id='table1']//tr[4]/td[2]
    link=textPattern
    link locator 用link來選擇HTML中的連接或錨元素
    例如:
    link=The link text
    在沒有l(wèi)ocator前序的情況下 Without a locator prefix, Selenium uses:
    如果以"document."開頭,則默認是使用 dom locator,如果是以"//"開頭,則默認使用xpath locator,其余情況均認作identifier locator

2.String Matching Patterns (字符串匹配模式)

    glob:patthern
    glob模式,用通配符"*"代表任意長度字符,"?"代表一個字符
    regexp:regexp
    正則表達式模式,用JavaScript正則表達式的形式匹配字符串
    exact:string
    精確匹配模式,精確匹配整個字符串,不能用通配符
    在沒有指定字符串匹配前序的時候,selenium 默認使用golb 匹配模式

3.Select Option Specifiers (Select選項指定器)

    label=labelPattern
    通過匹配選項中的文本指定選項
    例如:label=regexp:^[Oo]ther
    value=valuePattern
    通過匹配選項中的值指定選項
    例如:value=other
    id=id
    通過匹配選項的id指定選項
    例如: id=option1
    index=index
    通過匹配選項的序號指定選項,序號從0開始
    例如:index=2
    在沒有選項選擇前序的情況下,默認是匹配選項的文本

上一頁123下一頁
軟件測試工具 | 聯(lián)系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd