RobotFramework Selenium2 關鍵字

*** Settings ***
Library Selenium2Librarychrome

*** Keywords ***
Checkbox應該不被選擇
[Arguments] ${locator}
Checkbox Should Not Be Selected ${locator}windows

Frame應該包含文本
[Arguments] ${locator} ${text} ${loglevel}=INFO
Frame Should Contain ${locator} ${text} ${loglevel}瀏覽器

List應該無選項
[Arguments] ${locator}
List Should Have No Selections ${locator}cookie

List選項應該是
[Arguments] ${locator} @{items}
List Selection Should Be ${locator} @{items}less

Radio按鈕不該該被選擇
[Arguments] ${group_name}
Radio Button Should Not Be Selected ${group_name}dom

Radio按鈕應該被設置成
[Arguments] ${group_name} ${value}
Radio Button Should Be Set To ${group_name} ${value}異步

Url應該包含
[Arguments] ${expected}
Location Should Contain ${expected}url

Xpath應該匹配X次
[Arguments] ${xpath} ${expected_xpath_count} ${msg}= ${loglevel}=INFO
Xpath Should Match X Times ${xpath} ${expected_xpath_count} ${msg} ${loglevel}.net

checkbox應該被選擇
[Arguments] ${locator}
checkbox should be selected ${locator}code

url應該是
[Arguments] ${url}
Location Should Be ${url}

下次確認選擇取消
Choose Cancel On Next Confirmation

下次確認選擇肯定
Choose Ok On Next Confirmation

從List中取消選項
[Arguments] ${locator} @{items}
Unselect From List ${locator} @{items}

從List選擇選項
[Arguments] ${locator} @{items}
Select From List ${locator} @{items}

偏移拖拽
[Arguments] ${source} ${xoffset} ${yoffset}
Drag And Drop By Offset ${source} ${xoffset} ${yoffset}

元素應該不包含文本
[Arguments] ${locator} ${expected} ${msg}=
Element Should Not Contain ${locator} ${expected} ${msg}

元素應該不可用
[Arguments] ${locator}
Element Should Be Disabled ${locator}

元素應該不可見
[Arguments] ${locator} ${msg}=
Element Should Not Be Visible ${locator} ${msg}

元素應該包含文本
[Arguments] ${locator} ${text}
Element Should Contain ${locator} ${text}

元素應該匹配x次
[Arguments] ${locator} ${count} ${msg}= ${loglevel}=INFO
Locator Should Match X Times ${locator} ${count} ${msg} ${loglevel}

元素應該可用
[Arguments] ${locator}
Element Should Be Enabled ${locator}

元素應該可見
[Arguments] ${locator}
Element Should Be Visible ${locator}

元素文本應該是
[Arguments] ${locator} ${expected} ${msg}=
Element Text Should Be ${locator} ${expected} ${msg}

全選List元素
[Arguments] ${locator}
Select All From List ${locator}

關閉全部瀏覽器
Close All Browsers

關閉瀏覽器
Close Browser

關閉窗口
Close Window

切換瀏覽器
[Arguments] ${index}
Switch Browser ${index}

建立Webdriver
[Arguments] ${driver_name} ${alias}= ${kwargs}={}
Create Webdriver ${driver_name} ${alias} ${kwargs}

刪除Cookie
[Arguments] ${name}
Delete Cookie ${name}

刪除全部Cookie
Delete All Cookies

刪除本地策略
[Arguments] ${strategy_name}
Remove Location Strategy ${strategy_name}

刷新頁面
Reload Page

雙擊元素
[Arguments] ${locator}
Double Click Element ${locator}

取消選擇Checkbox
[Arguments] ${locator}
Unselect Checkbox ${locator}

取消選擇Frame
Unselect Frame

回退
Go Back

在圖片上按下鼠標左鍵
[Arguments] ${locator}
Mouse Down On Image ${locator}

在鏈接上按下鼠標左鍵
[Arguments] ${locator}
Mouse Down On Link ${locator}

應該出現警告彈窗
[Arguments] ${text}=
Alert Should Be Present ${text}

當前Frame不該該包含
[Arguments] ${text} ${loglvl}=INFO
Current Frame Should Not Contain ${text} ${loglvl}

當前Frame包含
[Arguments] ${text} ${loglevel}=INFO
Current Frame Contains ${text} ${loglevel}

截屏
[Arguments] @{filename}
Capture Page Screenshot @{filename}

打開瀏覽器
[Arguments] ${url} ${browser}=chrome @{args}
Open Browser ${url} ${browser} @{args}

打開菜單
[Arguments] ${locator}
Open Context Menu ${locator}

執行js
[Arguments] ${code}
Execute Javascript ${code}

執行異步js
[Arguments] ${code}
Execute Async Javascript ${code}

拖拽元素
[Arguments] ${source} ${target}
Drag And Drop ${source} ${target}

按下鼠標左鍵
[Arguments] ${locator}
Mouse Down ${locator}

按鍵
[Arguments] ${locator} ${key}
[Documentation] 按鍵 \ \ text_field \ \ q
...
... 按鍵 \ \ login_button \ \\13 \ \ #ASCII Code for enter Key
Press Key ${locator} ${key}

提交表單
[Arguments] ${locator}=
Submit Form ${locator}

文本區值應該是
[Arguments] ${locator} ${expected} ${msg}=
Textarea Value Should Be ${locator} ${expected} ${msg}

文本區應該包含
[Arguments] ${locator} ${expected} ${msg}=
Textarea Should Contain ${locator} ${expected} ${msg}

文本框值應該是
[Arguments] ${locator} ${expected} ${msg}=
Textfield Value Should Be ${locator} ${expected} ${msg}

文本框應該包含
[Arguments] ${locator} ${expected} ${msg}=
Textfield Should Contain ${locator} ${expected} ${msg}

最大化
Maximize Browser Window

標題應該是
[Arguments] ${title}
Title Should Be ${title}

根據Index從List中取消選項
[Arguments] ${locator} @{indexes}
Unselect From List By Index ${locator} @{indexes}

根據Index從List選擇
[Arguments] ${locator} @{indexes}
Select From List By Index ${locator} @{indexes}

根據Label從List中取消選項
[Arguments] ${locator} @{Labels}
Unselect From List By Label ${locator} @{Labels}

根據Label從List選擇
[Arguments] ${locator} @{labels}
Select From List By Label ${locator} @{labels}

根據Value從List中取消選項
[Arguments] ${locator} @{values}
Unselect From List By Value ${locator} @{values}

根據Value從List選擇
[Arguments] ${locator} @{values}
Select From List By Value ${locator} @{values}

根據值選擇列表元素
[Arguments] ${locator} ${value}
Select From List By Value ${locator} ${value}

模擬
[Arguments] ${locator} ${event}
Simulate ${locator} ${event}

註冊失敗後運行的關鍵字
[Arguments] ${kwd}
Register Keyword To Run On Failure ${kwd}

添加cookie
[Arguments] ${name} ${value} ${path}= ${domain}= ${secure}= ${expiry}=

添加本地策略
[Arguments] ${strategy_name} ${strategy_keyword} ${persist}=False
Add Location Strategy ${strategy_name} ${strategy_keyword} ${persist}

清除元素文本
[Arguments] ${locator}
Clear Element Text ${locator}

點擊元素
[Arguments] ${path}
Click Element ${path}

點擊元素座標
[Arguments] ${locator} ${xoffset} ${yoffset}
Click Element At Coordinates ${locator} ${xoffset} ${yoffset}

點擊圖片
[Arguments] ${locator}
Click Image ${locator}

點擊按鈕
[Arguments] ${path}
Click Button ${path}

點擊連接
[Arguments] ${locator}
Click Link ${locator}

睡眠
[Arguments] ${time}
Sleep ${time}

確認
Confirm Action

窗口列表
@{list} List Windows
[Return] @{list}

等待元素不包含文本
[Arguments] ${locator} ${text} ${timeout}= ${error}=
Wait Until Element Does Not Contain ${locator} ${text} ${timeout} ${error}

等待元素不可見
[Arguments] ${locator} ${timeout}= ${error}=
Wait Until Element Is Not Visible ${locator} ${timeout} ${error}

等待元素包含文本
[Arguments] ${locator} ${text} ${timeout}= ${error}=
Wait Until Element Contains ${locator} ${text} ${timeout} ${error}

等待元素可用
[Arguments] ${locator} ${timeout}= ${error}=
Wait Until Element Is Enabled ${locator} ${timeout} ${error}

等待元素可見
[Arguments] ${locator} ${timeout}=30
Wait Until Element Is Visible ${locator} ${timeout}

等待執行成功
[Arguments] ${timeout} ${retry} ${keyword} @{args}
Wait Until Keyword Succeeds ${timeout} minutes ${retry} sec ${keyword} @{args}

等待條件成立
[Arguments] ${condition} ${timeout}= ${error}=
Wait For Condition ${condition} ${timeout} ${error}

等待頁面不包含元素
[Arguments] ${locator} ${timeout}= ${error}=
Wait Until Page Does Not Contain Element ${locator} ${timeout} ${error}

等待頁面包含元素
[Arguments] ${locator} ${timeout}= ${error}=
Wait Until Page Contains Element ${locator} ${timeout} ${error}

等待頁面包含文本
[Arguments] ${text} ${timeout}= ${error}=
Wait Until Page Contains ${text} ${timeout} ${error}

給元素分配ID
[Arguments] ${locator} ${id}
Assign Id To Element ${locator} ${id}

獲取Cookie值
[Arguments] ${name}
${value} Get Cookie Value ${name}
[Return] ${value}

獲取List元素
[Arguments] ${locator}
@{items} Get List Items ${locator}

獲取List多個選定值
[Arguments] ${locator}
@{values} Get Selected List Values ${locator}
[Return] @{values}

獲取List多個選定標籤
[Arguments] ${locator}
@{labels} Get Selected List Labels ${locator}
[Return] @{labels}

獲取List選定值
[Arguments] ${locator}
${value} Get Selected List Value ${locator}
[Return] ${value}

獲取List選定標籤
[Arguments] ${locator}
${label} Get Selected List Label ${locator}
[Return] ${label}

獲取Selenium等待時間
${sec} Get Selenium Implicit Wait
[Return] ${sec}

獲取Selenium超時
${timeout} Get Selenium Timeout
[Return] ${timeout}

獲取Selenium速率
${res} Get Selenium Speed
[Return] ${res}

獲取xpath匹配次數
[Arguments] ${xpath}
${count} Get Matching Xpath Count ${xpath}
[Return] ${count}

獲取元素值
[Arguments] ${locator}
${value} Get Value ${locator}
[Return] ${value}

獲取元素屬性
[Arguments] ${attribute_locator}
Get Element Attribute ${attribute_locator}

獲取元素文本
[Arguments] ${locator}
${text} Get Text ${locator}
[Return] ${text}

獲取座標
${location} Get Location
[Return] ${location}

獲取垂直座標
[Arguments] ${locator}
${vertical} Get Vertical Position ${locator}
[Return] ${vertical}

獲取當前Url
${url} Log Location
[Return] ${url}

獲取當前頁面標題
${title} Log Title
[Return] ${title}

獲取全部Cookie
@{cookies} Get Cookies
[Return] @{cookies}

獲取全部鏈接
@{links} Get All Links
[Return] @{links}

獲取文本
[Arguments] ${path}
${text} get text ${path}
[Return] ${text}

獲取標題
${title} get title
[Return] ${title}

獲取水平座標
[Arguments] ${locator}
@{position} Get Horizontal Position ${locator}
[Return] @{position}

獲取焦點
[Arguments] ${locator}
Focus ${locator}

獲取窗口名字
@{names} Get Window Names
[Return] @{names}

獲取窗口座標
${x} ${y}= Get Window Position
[Return] ${x} ${y}

獲取窗口大小
${width} ${higth}= GET Window Size
[Return] ${width} ${higth}

獲取窗口標識
@{windows} Get Window Identifiers
[Return] @{windows}

獲取窗口標題
@{titles} Get Window Titles
[Return] @{titles}

獲取表格內容
[Arguments] ${table_locator} ${row} ${column} ${loglevel}=INFO
${cell} Get Table Cell ${table_locator} ${row} ${column} ${loglevel}
[Return] ${cell}

獲取警告信息
${msg} Get Alert Message
[Return] ${msg}

獲取資源
${source} Get Source
[Return] ${source}

獲取頁面元素
[Arguments] ${locator}
@{elements} Get Webelements ${locator}
[Return] @{elements}

獲取頁面標題
${title} Get Title
[Return] ${title}

獲取頁面資源
[Arguments] ${loglevel}=INFO
${source} Log Source ${loglevel}
[Return] ${source}

表頭應該包含
[Arguments] ${table_locator} ${expected} ${loglevel}=INFO
table header should contain ${table_locator} ${expected} ${loglevel}

表頭應該包含文本
[Arguments] ${table_locator} ${expected} ${loglevel}=INFO
Table Header Should Contain ${table_locator} ${expected} ${loglevel}

表應該包含文本
[Arguments] ${table_locator} ${expected} ${loglevel}=INFO
Table Should Contain ${table_locator} ${expected} ${loglevel}

表格Footer應該包含文本
[Arguments] ${table_locator} ${expected} ${loglevel}
Table Footer Should Contain ${table_locator} ${expected} ${loglevel}

表格列應該包含文本
[Arguments] ${table_locator} ${col} ${expected} ${loglevel}=INFO
Table Column Should Contain ${table_locator} ${col} ${expected} ${loglevel}

表格應該包含
[Arguments] ${table_locator} ${row} ${column} ${expected}
table cell should contain ${table_locator} ${row} ${column} ${expected}

表格應該包含文本
[Arguments] ${table_locator} ${row} ${column} ${expected} ${loglevel}=INFO
Table Cell Should Contain ${table_locator} ${row} ${column} ${expected} ${loglevel}

表格行應該包含文本
[Arguments] ${table_locator} ${row} ${expected} ${loglvl}=INFO
Table Row Should Contain ${table_locator} ${row} ${expected} ${loglvl}

設置Selenium等待
[Arguments] ${seconds}
${return} Set Selenium Implicit Wait ${seconds}
[Return] ${return}

設置Selenium超時
[Arguments] ${seconds}
Set Selenium Timeout ${seconds}

設置Selenium速率
[Arguments] ${speed}
Set Selenium Speed ${speed} seconds

設置瀏覽器等待時間
[Arguments] ${seconds}
Set Browser Implicit Wait ${seconds}

設置窗口座標
[Arguments] ${x} ${y}
Set Window Position ${x} ${y}

設置窗口大小
[Arguments] ${width} ${higth}
Set Window Size ${width} ${higth}

跳轉
[Arguments] ${url}
Go To ${url}

跳轉到
[Arguments] ${url}
go to ${url}

輸入密碼
[Arguments] ${path} ${passwd}
Input password ${path} ${passwd}

輸入文本
[Arguments] ${path} ${str}
Input Text ${path} ${str}

選擇Checkbox
[Arguments] ${locator}
Select Checkbox ${locator}

選擇Frame
[Arguments] ${locator}
Select Frame ${locator}

選擇Radio按鈕
[Arguments] ${group_name} ${value}
Select Radio Button ${group_name} ${value}

選擇文件
[Arguments] ${locator} ${file_path}
Choose File ${locator} ${file_path}

選擇窗口
[Arguments] ${locator}=
Select Window ${locator}

頁面應該不包含Checkbox
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Checkbox ${locator} ${msg} ${loglevel}

頁面應該不包含Link
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Link ${locator} ${msg} ${loglevel}

頁面應該不包含List
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain List ${locator} ${msg} ${loglevel}

頁面應該不包含Radio按鈕
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Radio Button ${locator} ${msg} ${loglevel}

頁面應該不包含元素
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Element ${locator} ${msg} ${loglevel}

頁面應該不包含圖片
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Image ${locator} ${msg} ${loglevel}

頁面應該不包含按鈕
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Button ${locator} ${msg} ${loglevel}

頁面應該不包含文本
[Arguments] ${text} ${lvl}=INFO
Page Should Not Contain ${text} ${lvl}

頁面應該不包含文本框
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Not Contain Textfield ${locator} ${msg} ${loglevel}

頁面應該包含Checkbox
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Checkbox ${locator} ${msg} ${loglevel}

頁面應該包含Link
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Link ${locator} ${msg} ${loglevel}

頁面應該包含List
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain List ${locator} ${msg} ${loglevel}

頁面應該包含Radio按鈕
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Radio Button ${locator} ${msg} ${loglevel}

頁面應該包含元素
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Element ${locator} ${msg} ${loglevel}

頁面應該包含圖片
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Image ${locator} ${msg} ${loglevel}

頁面應該包含按鈕
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Button ${locator} ${msg} ${loglevel}

頁面應該包含文本
[Arguments] ${text} ${loglevel}=INFO
Page Should Contain ${text} ${loglevel}

頁面應該包含文本框
[Arguments] ${locator} ${msg}= ${loglevel}=INFO
Page Should Contain Textfield ${locator} ${msg} ${loglevel}

鼠標懸停
[Arguments] ${locator}
Mouse Over ${locator}

鼠標移出
[Arguments] ${locator}
Mouse Out ${locator}

鼠標釋放 [Arguments] ${locator} Mouse Up ${locator}

相關文章
相關標籤/搜索