Add Cookie
Arguments:[ name | value | path=None | domain=None | secure=None | expiry=None ]
Adds a cookie to your current session. "name" and "value" are required, "path", "domain" and "secure" are optional
描述:添加一個 cookie 到你當前的 session 中。Name 和 value 變量為必輸項,path、domain 和 secure 是選輸項。
說明:暫未使用過,待補充......
Alert Should Be Present
Arguments:[ text= ]
Verifies an alert is present and dismisses it.
If `text` is a non-empty string, then it is also verified that the message of the alert equals to `text`.
Will fail if no alert is present. Note that following keywords will fail unless the alert is dismissed by this keyword or another like `Get Alert Message`.
說明:校驗是否有 alert 提示框出現。如果提示框信息不為空,則它將校驗 alert 信息是否與 text 一致。
例子:Alert Should Be Present | 保存成功
Assign Id To Element
Arguments:[ locator | id ]
Assigns a temporary identifier to element specified by `locator`.
This is mainly useful if the locator is complicated/slow XPath expression. Identifier expires when the page is reloaded.
說明:分配一個臨時ID給特殊元素(缺少ID或name)。
例子:Assign Id To Element | //div[@class='textarea-clear-btn'] | ClassID01
Call Client Method For Element
Arguments:[ locator | jsMethodName | *args ]
Call client method for element identified by `locator`.
說明:暫未使用過,待補充......
Capture Page Screenshot
Arguments:[ filename=None ]
Takes a screenshot of the current page and embeds it into the log.
`filename` argument specifies the name of the file to write the screenshot into. If no `filename` is given, the screenshot is saved into file `selenium-screenshot-<counter>.png` under the directory where the Robot Framework log file is written into. The `filename` is also considered relative to the same directory, if it is not given in absolute format.
`css` can be used to modify how the screenshot is taken. By default the bakground color is changed to avoid possible problems with background leaking when the page layout is somehow broken.
說明:截取當前頁面並將其嵌入到日志。Filename 參數指定寫入日志的截圖名稱。如果該參數為空,那么截圖名稱將以”selenium-screenshot-<counter>.png”格式保存到 RF志文件所在目錄下。
例子:Capture Page Screenshot | 截圖20160925001
Checkbox Should Be Selected
Arguments:[ locator ]
Verifies checkbox identified by `locator` is selected/checked.
Key attributes for checkboxes are `id` and `name`. See `introduction` for details about locating elements.
說明:驗證復選框已被選中/勾選。
例子:Checkbox Should Be Selected | CheckBoxIDorName
Checkbox Should Not Be Selected
Arguments:[ locator ]
Verifies checkbox identified by `locator` is not selected/checked.
Key attributes for checkboxes are `id` and `name`. See `introduction` for details about locating elements.
說明:驗證復選框未被選中/勾選。
例子:Checkbox Should Not Be Selected | CheckBoxIDorName
Choose Cancel On Next Confirmation
Arguments:[ ]
Cancel will be selected the next time `Confirm Action` is used.
說明:在含“確定/取消”的彈出框中選擇“取消”,需要與關鍵字(Confirm Action)組合使用。
例子:
Choose Cancel On Next Confirmation
Confirm Action #選擇“取消”
Choose File
Arguments:[ locator | file_path ]
Inputs the `file_path` into file input field found by `identifier`.
This keyword is most often used to input files into upload forms. The file specified with `file_path` must be available on the same host where the Selenium Server is running.
說明:選擇文件。在上傳頁面,直接使用該關鍵字。或與關鍵字(get file)組合使用。
例子:
choose file | xpath=//div[@class='pd6 dot fcb']/span/input | C:\\Documents and Settings\\xxx\\My Documents\\My Pictures\\bug5.png
choose file | get file | C:\\Documents and Settings\\xxx\\My Documents\\My Pictures\\bug5.png
Choose Ok On Next Confirmation
Arguments:[ ]
Undo the effect of using keywords `Choose Cancel On Next Confirmation`. Note that Selenium's overridden window.confirm() function will normally automatically return true, as if the user had manually clicked OK, so you shouldn't need to use this command unless for some reason you need to change your mind prior to the next confirmation. After any confirmation, Selenium will resume using the default behavior for future confirmations, automatically returning true (OK) unless/until you explicitly use `Choose Cancel On Next Confirmation` for each confirmation.
Note that every time a confirmation comes up, you must consume it by using a keywords such as `Get Alert Message`, or else the following selenium operations will fail.
說明:在含“確定/取消”的彈出框中選擇“確定”。
例子:Choose Ok On Next Confirmation
Click Button
Arguments:[ locator ]
Clicks a button identified by `locator`.
Key attributes for buttons are `id`, `name` and `value`. See `introduction` for details about locating elements.
說明:點擊按鈕。需要注意點擊對象必須是button,而非圖片、超鏈接、input。
例子:Click Button| ButtonOK
Click Element
Arguments:[ locator ]
Click element identified by `locator`.
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
說明:點擊元素。可運用在任何需要點擊的元素上:按鈕、圖片、文字、超鏈接等。
例子:Click Element | xpath=//input[@value='百度一下'] #點擊【百度一下】按鈕
Click Element At Coordinates
Arguments:[ locator | xoffset | yoffset ]
Click element identified by `locator` at x/y coordinates of the element. Cursor is moved and the center of the element and x/y coordinates are calculted from that point.
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
說明:通過 x,y 坐標點擊頁面元素。
例子:暫未使用過,待補充......
Click Element Via Js
Arguments:[ locator ]
Click element identified by `locator` via javascript.
說明:通過JavaScript定位元素。
例子:暫未使用過,待補充......
Click Image
Arguments:[ locator ]
Clicks an image found by `locator`.
Key attributes for images are `id`, `src` and `alt`. See `introduction` for details about locating elements.
說明:點擊被定位的圖片。
例子:
Click Image | imgLogo
Click Image | xpath=//img[src='https://xx.xxx.xxxx.com/t0151320b1d0fc50be8.png']
Click Link
Arguments:[ locator ]
Clicks a link identified by locator.
Key attributes for links are `id`, `name`, `href` and link text. See `introduction` for details about locating elements.
說明:點擊被定位的鏈接。
例子:Click Link | LinkID
Close All Browsers
Arguments:[ ]
Closes all open browsers and resets the browser cache.
After this keyword new indexes returned from `Open Browser` keyword are reset to 1.
This keyword should be used in test or suite teardown to make sure all browsers are closed.
說明:關閉全部打開狀態的瀏覽器並重置緩存。執行完該關鍵字后,再次打開瀏覽器,瀏覽器對應 index 值從 1 開始計算。關鍵字必須在 test 或者 suite 的 teardown 時使用,為了確保所有瀏覽器已被關閉。
Close Browser
Arguments:[ ]
Closes the current browser.
說明:關閉當前瀏覽器。
Close Window
Arguments:[ ]
Closes currently opened pop-up window.
說明:關閉當前打開(置頂)的彈出框。
Confirm Action
Arguments:[ ]
Dismisses currently shown confirmation dialog and returns it's message.
By default, this keyword chooses 'OK' option from the dialog. If 'Cancel' needs to be chosen, keyword `Choose Cancel On Next Confirmation` must be called before the action that causes the confirmation dialog to be shown.
說明:當前顯示 confirm 對話框並返回它的 message 信息。默認情況下,該關鍵字選擇對話框中的“確定”項。如果需要選擇“取消”項,請在該關鍵字執行前調用“Choose Cancel On Next Confirmation”,以免對話框已關閉。
例子1:
Confirm Action #單獨使用時,默認點擊【確定】
例子2:
Choose Cancel On Next Confirmation
Confirm Action #配合關鍵字Choose Cancel On Next Confirmation使用,則點擊【取消】
Current Frame Contains
Arguments:[ text | loglevel=INFO ]
Verifies that current frame contains `text`.
See `Page Should Contain ` for explanation about `loglevel` argument.
說明:驗證當前frame包含的文本內容。可以查看“Page Should Contain”關於loglevel 參數的解釋。
例子:暫未使用過,待補充......
Current Frame Should Not Contain
Arguments:[ text | loglevel=INFO ]
Verifies that current frame contains `text`.
See `Page Should Contain ` for explanation about `loglevel` argument.
說明:驗證當前frame不應包含的文本。可以查看“Page Should Contain”關於loglevel 參數的解釋。
例子:暫未使用過,待補充......
Delete All Cookies
Arguments:[ ]
Deletes all cookies.
說明:刪除所有Cookies。
例子:暫未使用過,待補充......
Delete Cookie
Arguments:[ name ]
Deletes cookie matching `name`.
If the cookie is not found, nothing happens.
說明:刪除與參數 name 匹配的 cookies 信息。當未匹配到對應 name 的 cookies 信息,則不執行。
例子:暫未使用過,待補充......
Double Click Element
Arguments:[ locator ]
Double click element identified by `locator`.
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
說明:雙擊元素。
例子:Double Click Element | ElementID
Drag And Drop
Arguments:[ source | target ]
Drags element identified with `source` which is a locator.
Element can be moved on top of another element with `target` argument.
`target` is a locator of the element where the dragged object is dropped.
說明:拖拽被定位 element 元素。Element 可被移動到其他目標參數上。目標為一個元素定位器,可以將對象拖拽並放下。
例子:暫未使用,待補充......
Drag And Drop By Offset
Arguments:[ source | xoffset | yoffset ]
Drags element identified with `source` which is a locator.
Element will be moved by xoffset and yoffset. each of which is a negative or positive number specify the offset.
說明:將某元素從source處拖放到XY坐標指定處。
例子:暫未使用,待補充......
Element Should Be Disabled
Arguments:[ locator ]
Verifies that element identified with `locator` is disabled.
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
說明:驗證元素應被禁用(不可用)。
例子:Element Should Be Disabled | ElementID
Element Should Be Enabled
Arguments:[ locator ]
Verifies that element identified with `locator` is enabled.
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
說明:驗證元素應可用。
例子:Element Should Be Enabled | ElementID
Element Should Be Visible
Arguments:[ locator | message= ]
Verifies that the element identified by `locator` is visible.
Herein, visible means that the element is logically visible, not optically visible in the current browser viewport. For example, an element that carries display:none is not logically visible, so using this keyword on that element would fail.
`message` can be used to override the default error message.
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
說明:驗證元素應可見(頁面有顯示)。
例子:Element Should Be Visible | ElementID | 返回自定義錯誤消息:對不起,該元素不可見。
Element Should Contain
Arguments:[ locator | expected | message= ]
Verifies element identified by `locator` contains text `expected`.
If you wish to assert an exact (not a substring) match on the text of the element, use `Element Text Should Be`.
`message` can be used to override the default error message.
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
說明:驗證元素應包含的文本。
例子:Element Should Contain | ElementID | 期望的文本內容 | 返回自定義錯誤消息:對不起,該元素不包含XXX文本。
Element Should Not Be Visible
Arguments:[ locator | message= ]
Verifies that the element identified by `locator` is NOT visible.
This is the opposite of `Element Should Be Visible`.
`message` can be used to override the default error message.
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
說明:驗證元素應是不可見的。
例子:Element Should Not Be Visible | ElementID | 返回自定義錯誤消息:對不起,該元素卻可見。
Element Text Should Be
Arguments:[ locator | expected | message= ]
Verifies element identified by `locator` exactly contains text `expected`.
In contrast to `Element Should Contain`, this keyword does not try a substring match but an exact match on the element identified by `locator`.
`message` can be used to override the default error message.
Key attributes for arbitrary elements are `id` and `name`. See `introduction` for details about locating elements.
說明:驗證元素應完全包含的文本。
例子:Element Text Should Be | ElementID | 期望的文本內容 | 返回自定義錯誤消息:對不起,該元素不完全包含XXX文本。
Execute Async Javascript
Arguments:[ *code ]
Executes asynchronous JavaScript code.
`code` may contain multiple lines of code but must contain a return statement (with the value to be returned) at the end.
`code` may be divided into multiple cells in the test data. In that case, the parts are catenated together without adding spaces.
If `code` is an absolute path to an existing file, the JavaScript to execute will be read from that file. Forward slashes work as a path separator on all operating systems.
Note that, by default, the code will be executed in the context of the Selenium object itself, so `this` will refer to the Selenium object. Use `window` to refer to the window of your application, e.g. `window.document.getElementById('foo')`.
說明:
執行異步 java 腳本代碼。代碼可以包含多行代碼但是必須包含返回信息。代碼可以在測試數據中被分割為多個單元。即便如此,彼此關聯的組件間不允許任意增加空間。
如果被執行代碼的路徑為絕對路徑,那么 javascript 將從這個絕對路徑文件中讀取並運行。
例子:未使用過,待補充......
Execute Javascript
Arguments:[ *code ]
Executes the given JavaScript code.
`code` may contain multiple lines of code but must contain a return statement (with the value to be returned) at the end.
`code` may be divided into multiple cells in the test data. In that case, the parts are catenated together without adding spaces.
If `code` is an absolute path to an existing file, the JavaScript to execute will be read from that file. Forward slashes work as a path separator on all operating systems.
Note that, by default, the code will be executed in the context of the Selenium object itself, so `this` will refer to the Selenium object. Use `window` to refer to the window of your application, e.g. `window.document.getElementById('foo')`.
說明:執行JavaScript腳本。
例子:Execute JavaScript | window.my_js_function('arg1', 'arg2')
Focus
Arguments:[ locator ]
Sets focus to element identified by `locator`.
說明:聚焦元素。如某元素在頁面上因拖動滾動條才能顯示的,對該元素操作前,可使用Focus將焦點定位到該元素上,避免元素操作時找不到該元素。
例子:Focus | ElementID
Frame Should Contain
Arguments:[ locator | text | loglevel=INFO ]
Verifies frame identified by `locator` contains `text`.
See `Page Should Contain ` for explanation about `loglevel` argument.
Key attributes for frames are `id` and `name.` See `introduction` for details about locating elements.
說明:驗證Frame(框架)應該包含的文本。
例子:Frame Should Contain | ElementID| 期望的文本
Get Alert Message
Arguments:[ ]
Returns the text of current JavaScript alert.
This keyword will fail if no alert is present. Note that following keywords will fail unless the alert is dismissed by this keyword or another like `Get Alert Message`.
說明:返回警報彈出消息的文本內容,將文本返回給參數。
例子:${ReturnMessage} | Get Alert Message
Get All Links
Arguments:[ ]
Returns a list containing ids of all links found in current page.
If a link has no id, an empty string will be in the list instead.
說明:返回當前頁包含的所有鏈接,將鏈接以列表的形式返回給參數。
例子:${ReturnLinks} | Get All Links
Get Cookie Value
Arguments:[ name ]
Returns value of cookie found with `name`.
If no cookie is found with `name`, this keyword fails.
說明:返回cookie的值,將值返回給參數。
例子:${ReturnValue} | Get Cookie Value | CookieName
Get Cookies
Arguments:[ ]
Returns all cookies of the current page.
說明:返回當前頁面的所有Cookies,將Cookies返回給參數。
例子:${ReturnCookies} | Get Cookies
Get Element Attribute
Arguments:[ attribute_locator ]
Return value of element attribute.
`attribute_locator` consists of element locator followed by an @ sign and attribute name, for example "element_id@class".
說明:返回元素的指定屬性內容,將屬性內容返回給參數。
例子:${ReturnValue} | Get Element Attribute | element_id@class