*** Settings *** Documentation Simple example using SeleniumLibrary. Library SeleniumLibrary 官網地址 https://pypi.org/project/robotframework-seleniumlibrary/#extending-seleniumlibrary *** Variables *** ${LOGIN URL} http://localhost:7272 --定義URL 地址 ${BROWSER} Chrome --選擇驅動的瀏覽器 *** Test Cases *** 打開瀏覽器登陸 例子 Valid Login Open Browser To Login Page ---打開瀏覽器 Input Username demo ----填寫姓名 Input Password mode ----填寫密碼 Submit Credentials ----提交表單 Welcome Page Should Be Open [Teardown] Close Browser ---關閉瀏覽器 *** Keywords *** 分解登陸 Open Browser To Login Page Open Browser ${LOGIN URL} ${BROWSER} Title Should Be Login Page Input Username 分解輸入用戶 [Arguments] ${username} Input Text username_field ${username} Input Password 分解輸入密碼 [Arguments] ${password} Input Text password_field ${password} Submit Credentials 點擊提交按鈕 Click Button login_button Welcome Page Should Be Open ---斷言 驗證 Title Should Be Welcome Page
SeleniumLibrary中須要與網頁上的元素交互的全部關鍵字都採用一般命名的參數來locator
指定如何查找元素。大多數狀況下,定位器使用下面描述的定位器語法做爲字符串給出,但也能夠使用WebElements。css
SeleniumLibrary支持基於不一樣策略查找元素,例如元素id,XPath表達式或CSS選擇器。可使用前綴顯式指定策略,也能夠隱式策略。html
默認狀況下,定位器被視爲使用關鍵字特定的默認定位器策略。全部關鍵字都支持基於id
和name
屬性查找元素,但某些關鍵字支持其上下文中有意義的其餘屬性或其餘值。例如,Click Link支持href
屬性和連接文本以及正常id
和添加name
python
Examples:jquery
Click Element | example | # Match based on id or name . 匹配基於id 或name |
Click Link | example | # Match also based on link text and href .匹配也基於連接文本和href |
Click Button | example | # Match based on id , name or value . 匹配基於id ,name 或value |
若是定位器意外地以識別爲顯式定位器策略或隱式XPath策略的前綴啓動,則可使用顯式default
前綴來啓用默認策略android
Examples:git
Click Element | name:foo | # Find element with name foo . 查找名稱元素foo |
Click Element | default:name:foo | # Use default strategy with value name:foo . 使用帶有值的默認策略name:foo |
Click Element | //foo | # Find element using XPath //foo . 使用XPath查找元素//foo |
Click Element | default: //foo | # Use default strategy with value //foo . 使用帶有值的默認策略//foo |
使用語法strategy:value
或使用前綴指定顯式定位器策略strategy=value
。前一種語法是首選,由於後者與Robot Framework的命名參數語法相同,而且可能致使問題。圍繞分離空間被忽略,所以id:foo
,id: foo
和id : foo
都是等效的。github
Locator strategies that are supported by default are listed in the table below. In addition to them, it is possible to register custom locators.web
Strategy | Match based on | Example |
---|---|---|
id | Element id . |
id:example |
name | name attribute. |
name:example |
identifier | Either id or name . |
identifier:example |
class | Element class . |
class:example |
tag | Tag name. | tag:div |
xpath | XPath expression. | xpath://div[@id="example"] |
css | CSS selector. | css:div#example |
dom | DOM expression. | dom:document.images[5] |
link | Exact text a link has. | link:The example |
partial link | Partial link text. | partial link:he ex |
sizzle | Sizzle selector provided by jQuery. | sizzle:div.example |
jquery | Same as the above. | jquery:div.example |
default | Keyword specific default behavior. | default:example |
有關默認策略如何工做的詳細信息,請參閱下面的「 默認定位器策略」部分。default
僅當定位符值自己意外地匹配某些顯式策略時,才須要使用顯式前綴。chrome
不一樣的定位策略有不一樣的優缺點。使用IDS,明確地喜歡id:foo
或使用默認的定位策略只是想foo
,若是條件可能,由於語法很簡單,由一個id定位元素是快的瀏覽器。若是元素沒有id或id不穩定,則須要使用其餘解決方案。若是一個元素都有一個惟一的標籤名稱或類別,使用tag
,class
或css
策略同樣tag:h1
,class:example
或者css:h1.example
是常常一個簡單的解決方案。在更復雜的狀況下,使用XPath表達式一般是最好的方法。它們很是強大,但缺點是它們也會變得複雜。express
Examples:
Click Element | id:foo | # Element with id 'foo'. |
Click Element | css:div#foo h1 | # h1 element under div with id 'foo'. |
Click Element | xpath: //div[@id="foo"]//h1 | # Same as the above using XPath, not CSS. |
Click Element | xpath: //*[contains(text(), "example")] | # Element containing text 'example'. |
注意:
strategy:value
只有SeleniumLibrary 3.0及更高版本支持該語法。sizzle
策略或其別名jquery
要求被測系統包含jQuery庫。xpath
,css
並sizzle/jquery
戰略。若是定位器以//
或開頭(//
,則定位器被視爲XPath表達式。換句話說,使用//div
等同於使用顯式xpath://div
。
例子:
Click Element | //div[@id="foo"]//h1 |
Click Element | (//div)[2] |
The support for the (//
prefix is new in SeleniumLibrary 3.0.
除了將定位器指定爲字符串以外,還可使用Selenium的WebElement對象。這須要首先獲取WebElement
${elem} = | Get WebElement | id:example |
Click Element | ${elem} |
若是須要比經過默認定位器提供的查找更復雜的查找,則能夠建立自定義查找策略。使用自定義定位器是一個兩部分過程。首先,建立一個返回應該對其執行操做的WebElement的關鍵字:
Custom Locator Strategy | [Arguments] | ${browser} | ${strategy} | ${tag} | ${constraints} |
${element}= | Execute Javascript | return window.document.getElementById('${criteria}'); | |||
[Return] | ${element} |
此關鍵字是對id
定位器基本功能的從新實現,其中${browser}
是對WebDriver實例的引用,而且${strategy}
是定位器策略的名稱。要使用此定位器,必須首先使用「 添加位置策略」關鍵字進行註冊:
Add Location Strategy | custom | Custom Locator Strategy 自定義定位器策略 |
The first argument of Add Location Strategy specifies the name of the strategy and it must be unique. After registering the strategy, the usage is the same as with other locators:
Click Element | custom:example |
See the Add Location Strategy keyword for more details.
本節討論如何等待元素在網頁上顯示以及下降執行速度的不一樣方法。它還解釋了設置各類超時,等待和延遲時可使用的時間格式。
SeleniumLibrary包含各類關鍵字,timeout
這些關鍵字具備可選參數,用於指定這些關鍵字應等待某些事件或操做的時間。這些關鍵字包括例如Wait ...
與警報相關的關鍵字和關鍵字。
這些關鍵字使用的默認超時能夠經過使用Set Selenium Timeout關鍵字或導入庫timeout
時的參數進行全局設置。請參閱如下時間格式以獲取支持的超時語
隱式等待指定Selenium在搜索元素時等待的最長時間。可使用Set Selenium Implicit Wait關鍵字或導入庫implicit_wait
時的參數進行設置。有關此功能的更多信息,請參閱Selenium文檔。
請參閱如下時間格式以獲取支持的語
All timeouts and waits can be given as numbers considered seconds (e.g. 0.5
or 42
) or in Robot Framework's time syntax (e.g. 1.5 seconds
or 1 min 30 s
). For more information about the time syntax see the Robot Framework User Guide.
SeleniumLibrary有一個方便的功能,它能夠自動執行關鍵字,若是任何本身的關鍵字失敗。默認狀況下,它使用Capture Page Screenshot關鍵字,但可使用「 註冊關鍵字運行失敗」關鍵字或導入庫run_on_failure
時的參數進行更改。可使用任何導入的庫或資源文件中的任何關鍵字。
能夠經過使用特殊值NOTHING
或任何被視爲false的函數(請參閱布爾參數)來禁用運行失敗功能NONE
。
Some keywords accept arguments that are handled as Boolean values true or false. If such an argument is given as a string, it is considered false if it is either empty or case-insensitively equal to false
, no
or none
. Other strings are considered true regardless their value, and other argument types are tested using same rules as in Python.
True examples:
Set Screenshot Directory | ${RESULTS} | persist=True | # Strings are generally true. |
Set Screenshot Directory | ${RESULTS} | persist=yes | # Same as the above. |
Set Screenshot Directory | ${RESULTS} | persist=${TRUE} | # Python True is true. |
Set Screenshot Directory | ${RESULTS} | persist=${42} | # Numbers other than 0 are true. |
False examples:
Set Screenshot Directory | ${RESULTS} | persist=False | # String false is false. |
Set Screenshot Directory | ${RESULTS} | persist=no | # Also string no is false. |
Set Screenshot Directory | ${RESULTS} | persist=NONE | # String NONE is false. |
Set Screenshot Directory | ${RESULTS} | persist=${EMPTY} | # Empty string is false. |
Set Screenshot Directory | ${RESULTS} | persist=${FALSE} | # Python False is false. |
Set Screenshot Directory | ${RESULTS} | persist=${NONE} | # Python None is false. |
Arguments | Documentation |
---|---|
timeout=5.0, implicit_wait=0.0, run_on_failure=Capture Page Screenshot,screenshot_root_directory=None | SeleniumLibrary can be imported with several optional arguments.
|
Add Cookie · Add Location Strategy · Alert Should Be Present · Alert Should Not Be Present · Assign Id To Element · Capture Page Screenshot · Checkbox Should Be Selected · Checkbox Should Not Be Selected ·Choose Cancel On Next Confirmation · Choose File · Choose Ok On Next Confirmation · Clear Element Text · Click Button · Click Element · Click Element At Coordinates · Click Image · Click Link · Close All Browsers · Close Browser ·Close Window · Confirm Action · Create Webdriver · Current Frame Contains · Current Frame Should Contain · Current Frame Should Not Contain · Delete All Cookies · Delete Cookie · Dismiss Alert · Double Click Element ·Drag And Drop · Drag And Drop By Offset · Element Should Be Disabled · Element Should Be Enabled · Element Should Be Focused · Element Should Be Visible · Element Should Contain · Element Should Not Be Visible ·Element Should Not Contain · Element Text Should Be · Element Text Should Not Be · Execute Async Javascript · Execute Javascript · Focus · Frame Should Contain · Get Alert Message · Get All Links · Get Cookie · Get Cookie Value ·Get Cookies · Get Element Attribute · Get Element Count · Get Element Size · Get Horizontal Position · Get List Items · Get Location · Get Locations · Get Matching Xpath Count · Get Selected List Label · Get Selected List Labels ·Get Selected List Value · Get Selected List Values · Get Selenium Implicit Wait · Get Selenium Speed · Get Selenium Timeout · Get Source · Get Table Cell · Get Text · Get Title · Get Value · Get Vertical Position · Get WebElement ·Get WebElements · Get Window Handles · Get Window Identifiers · Get Window Names · Get Window Position · Get Window Size · Get Window Titles · Go Back · Go To · Handle Alert · Input Password · Input Text · Input Text Into Alert· Input Text Into Prompt · List Selection Should Be · List Should Have No Selections · List Windows · Location Should Be · Location Should Contain · Locator Should Match X Times · Log Location · Log Source · Log Title ·Maximize Browser Window · Mouse Down · Mouse Down On Image · Mouse Down On Link · Mouse Out · Mouse Over · Mouse Up · Open Browser · Open Context Menu · Page Should Contain · Page Should Contain Button ·Page Should Contain Checkbox · Page Should Contain Element · Page Should Contain Image · Page Should Contain Link · Page Should Contain List · Page Should Contain Radio Button · Page Should Contain Textfield ·Page Should Not Contain · Page Should Not Contain Button · Page Should Not Contain Checkbox · Page Should Not Contain Element · Page Should Not Contain Image · Page Should Not Contain Link · Page Should Not Contain List ·Page Should Not Contain Radio Button · Page Should Not Contain Textfield · Press Key · Radio Button Should Be Set To · Radio Button Should Not Be Selected · Register Keyword To Run On Failure · Reload Page ·Remove Location Strategy · Select All From List · Select Checkbox · Select Frame · Select From List · Select From List By Index · Select From List By Label · Select From List By Value · Select Radio Button · Select Window ·Set Browser Implicit Wait · Set Focus To Element · Set Screenshot Directory · Set Selenium Implicit Wait · Set Selenium Speed · Set Selenium Timeout · Set Window Position · Set Window Size · Simulate · Simulate Event · Submit Form ·Switch Browser · Table Cell Should Contain · Table Column Should Contain · Table Footer Should Contain · Table Header Should Contain · Table Row Should Contain · Table Should Contain · Textarea Should Contain ·Textarea Value Should Be · Textfield Should Contain · Textfield Value Should Be · Title Should Be · Unselect All From List · Unselect Checkbox · Unselect Frame · Unselect From List · Unselect From List By Index ·Unselect From List By Label · Unselect From List By Value · Wait For Condition · Wait Until Element Contains · Wait Until Element Does Not Contain · Wait Until Element Is Enabled · Wait Until Element Is Not Visible ·Wait Until Element Is Visible · Wait Until Page Contains · Wait Until Page Contains Element · Wait Until Page Does Not Contain · Wait Until Page Does Not Contain Element · Xpath Should Match X Times
添加曲奇 · 添加位置策略 · 警報應該存在 · 警報應該不存在 · 指定ID來元 · 捕獲頁面截圖 · 複選框應選擇 · 複選框,則不該選擇 · 選擇取消在接下來確認 · 選擇文件 · 選擇肯定(OK)下一個確認 · 清除元素文本 · 單擊按鈕 · 單擊元素 · 單擊座標時的元素 ·單擊圖像 · 單擊連接 · 關閉全部瀏覽器 · 關閉瀏覽器 · 關閉窗口 · 確認操做 · 建立Webdriver · 當前幀包含 · 當前幀應包含 · 當前幀不該包含 · 刪除全部Cookie · 刪除Cookie · 關閉警報 · 雙擊元素 · 拖放 · 拖放拖放 · 元素應禁用 · 元素應啓用 · 元素應聚焦 ·元素應該是可見的 · 元素應該包含 · 元素不該該是可見的 · 元素不該該包含 · 元素文本應該是 · 元素文本不該該 · 執行異步Javascript · 執行Javascript · 焦點 · 框架應該包含 · 獲取警報消息 · 獲取全部連接 · 獲取Cookie · 獲取Cookie值 · 獲取Cookie ·獲取元素屬性 · 獲取元素計數 · 獲取元素大小 · 獲取水平位置 · 獲取列表項 · 獲取位置 · 獲取位置 · 獲取匹配的XPath計數 · 獲取選定列表標籤 · 獲取選定列表標籤 · 獲取所選列表值 · 獲取選定的值列表 · 讓Selenium隱等待 · 讓Selenium速度 ·讓Selenium超時 · 獲取源 · 獲取表格單元格 · 獲取文本 · 拿不到冠軍 · 獲取價值 · 獲取垂直位置 · 獲取Web元素 · 獲取Web元素 · 獲取窗口句柄 · 獲取窗口標識符 · 獲取窗口名稱 · 獲取窗口位置 · 獲取窗口大小 · 獲取窗口標題 · 返回 · 轉到 · 處理警報 ·輸入密碼 · 輸入文本 · 輸入文本到警報 · 輸入文本到提示 · 列表選擇應該 · 列表應該沒有選擇 · 列出Windows · 位置應該 · 位置應該包含 · 定位器應該匹配X次 · 日誌位置 · 日誌源 · 日誌標題 · 最大化瀏覽器窗口 · 鼠標按下 · 鼠標按下圖像 · 鼠標按下連接 ·鼠標移動 · 鼠標移動 · 鼠標移動 · 打開瀏覽器 · 打開上下文菜單 · 頁面應包含 · 頁面應包含按鈕 · 頁面應包含複選框 · 頁面應包含元素 · 頁面應包含圖像 · 頁面應包含連接 · 頁面應包含列表 · 頁面應包含單選按鈕 · 頁面應包含文本字段 · 頁面不該包含 ·頁面不該包含按鈕 · 頁面不該包含複選框 · 頁面不該包含元素 · 頁面不該包含圖像 · 頁面不該包含連接 · 頁面不該包含列表 · 頁面不該包含單選按鈕 · 頁面不該包含文本字段 · 按鍵 · 單選按鈕應設置爲 · 單選按鈕,則不該選擇 · 註冊關鍵字上運行故障 ·刷新頁面 · 刪除定位策略 · 選擇所有從列表 · 選擇複選框 · 選擇第一幀 · 從列表中選擇 · 從列表中選擇按索引 · 從列表中選擇按標籤 · 選擇從按價值列出 · 選擇單選按鈕 · 選擇窗口 · 設置瀏覽器隱式等待 · 將焦點設置爲元素 · 設置屏幕截圖目錄 ·設置Selenium隱式等待 · 設置Selenium速度 · 設置Selenium超時 · 設置窗口位置 · 設置窗口大小 · 模擬 · 模擬事件 · 提交表單 · 切換瀏覽器 · 表單元格應包含 · 表列應該包含 · 表格底部應該包含 · 表頭應該包含 · 錶行應該包含 · 表應包含 ·多行文本應該包含 · textarea的值應該是 ? 文本框應該包含 · 文本字段的值應該 · 標題應該是 · 取消所有從列表 · 取消選擇複選框 · 取消選擇框 · 取消選擇從列表 · 取消選擇從列表按索引 · 取消選擇從列表按標籤 · 取消選擇從列表按值 · 等待條件 ·等到元素包含 · 等到元素不包含 · 等到元素被啓用 · 等到元素不可見 · 等到元素可見 · 等到頁面包含 · 等到頁面包含元素 · 等到頁面不包含 · 等待直到頁面不包含元素 · Xpath應匹配X次
Keyword | Arguments | Documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Add Cookie 添加Cookie | name, value, path=None,domain=None, secure=None,expiry=None | Adds a cookie to your current session.
Example:
Prior to SeleniumLibrary 3.0 setting expiry did not work. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Add Location Strategy 添加位置策略 | strategy_name, strategy_keyword,persist=False | 添加自定義位置策略。 有關如何建立和使用自定義策略的信息,請參閱自定義定位器。刪除位置策略可用於刪除已註冊的策略。 默認狀況下,在離開當前做用域後會自動刪除位置策略。設置 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Alert Should Be Present 警報應該存在 | text=, action=ACCEPT, timeout=None | 驗證是否存在警報,而且默認狀況下接受警報。 若是沒有警報則失敗。若是
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Alert Should Not Be Present 警報不該該存在 | action=ACCEPT, timeout=0 |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Assign Id To Element | locator, id | 將臨時分配 若是定位器是複雜的和/或緩慢的XPath表達式而且須要屢次,則這很是有用。標識符在從新加載頁面時到期。 Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Capture Page Screenshot 捕獲頁面截圖 | filename=selenium-screenshot-{index}.png | 獲取當前頁面的屏幕截圖並將其嵌入到日誌文件中。
從SeleniumLibrary 1.8開始,若是 返回建立的屏幕截圖文件的絕對路徑 Examples:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Checkbox Should Be Selected 應選中複選框 | locator |
See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Checkbox Should Not Be Selected不該選中複選框 | locator |
See the Locating elements section for details about the locator syntax.. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Choose Cancel On Next Confirmation | 已過期。請直接使用Handle Alert。 In versions prior to SeleniumLibrary 3.0, the alert handling approach needed to be set separately before using the Confirm Action keyword. New Handle Alert keyword accepts the action how to handle the alert as a normal argument and should be used instead. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Choose File 選擇文件 | locator, file_path | 輸入 此關鍵字最經常使用於將文件輸入上載表單。指定的文件
Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Choose Ok On Next Confirmation | 已過期。請直接使用Handle Alert In versions prior to SeleniumLibrary 3.0, the alert handling approach needed to be set separately before using the Confirm Action keyword. New Handle Alert keyword accepts the action how to handle the alert as a normal argument and should be used instead. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Clear Element Text 清除元素文本 | locator | 清除標識的文本輸入元素的值 See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Click Button 單擊按鈕 | locator | 點擊按鈕標識 See the Locating elements section for details about the locator syntax. When using the default locator strategy, buttons are searched using |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Click Element 單擊元素 | locator | 單擊標識的元素 See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Click Element At Coordinates 單擊座標處的元素 | locator, xoffset, yoffset |
See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Click Image 單擊圖像 | locator | 單擊標識的圖像 See the Locating elements section for details about the locator syntax. When using the default locator strategy, images are searched using |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Click Link 單擊連接 | locator | 單擊標識的連接 See the Locating elements section for details about the locator syntax. When using the default locator strategy, links are searched using |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Close All Browsers 關閉全部瀏覽器 | 關閉全部打開的瀏覽器並重置瀏覽器緩存。 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. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Close Browser 關閉瀏覽器 | 關閉當前瀏覽器。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Close Window 關閉窗口 | 關閉當前打開的彈出窗口。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Confirm Action 確認行動 | 已過期。請改用Handle Alert。 By default accepts an alert, but this behavior can be altered with Choose Cancel On Next Confirmation and Choose Ok On Next Confirmation keywords. New Handle Alert keyword accepts the action how to handle the alert as a normal argument and should be used instead. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Create Webdriver 建立Webdriver | driver_name, alias=None, kwargs={},**init_kwargs | Creates an instance of Selenium WebDriver. Like Open Browser, but allows passing arguments to the created WebDriver instance directly. This keyword should only be used if functionality provided by Open Browser is not adequate.
The initialized WebDriver can be configured either with a Python dictionary Examples:
Returns the index of this browser instance which can be used later to switch back to it. Index starts from 1 and is reset back to it when Close All Browsers keyword is used. See Switch Browser for an example. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Current Frame Contains | text, loglevel=INFO | 已過期. Use Current Frame Should Contain instead. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Current Frame Should Contain 當前框架應包含 | text, loglevel=INFO | 驗證當前幀是否包含 See Page Should Contain for explanation about the Prior to SeleniumLibrary 3.0 this keyword was named Current Frame Contains. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Current Frame Should Not Contain 當前框架不該包含 | text, loglevel=INFO | 驗證當前幀是否包含 See Page Should Contain for explanation about the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Delete All Cookies刪除全部Cookie | 刪除全部cookie。 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Delete Cookie 刪除Cookie | name | 刪除cookie匹配 If the cookie is not found, nothing happens. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Dismiss Alert | accept=True | 已過期. Use Handle Alert instead. Contrary to its name, this keyword accepts the alert by default (i.e. presses Handle Alert has better support for controlling should the alert be accepted, dismissed, or left open. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Double Click Element 雙擊元素 | locator | 雙擊標識的元素 See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Drag And Drop 拖放 | locator, target | drags元素由 該
Example:
拖放CSS:DIV元素#CSS:div.target
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Drag And Drop By Offset經過偏移拖放 | locator, xoffset, yoffset | 拖拽元素 元素將被移動, Example:
經過偏移拖放myElem50-35#向右移動myElem 50px,向下移動35px |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Be Disabled 元素應該被禁用 | locator | 驗證標識的元素 This keyword considers also elements that are read-only to be disabled. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Be Enabled 應該啓用元素 | locator | 驗證 This keyword considers also elements that are read-only to be disabled. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Be Focused 元素應該集中 | locator | 驗證標識的元素 See the Locating elements section for details about the locator syntax. New in SeleniumLibrary 3.0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Be Visible 元素應該是可見的 | locator, message=None | 驗證標識的元素 這裏,visible表示該元素在邏輯上可見,在當前瀏覽器視口中不是光學可見的。例如,攜帶的元素在 該 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Contain 元素應該包含 | locator, expected, message=None,ignore_case=False |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Not Be Visible | locator, message=None | 驗證標識的元素 Passes if element does not exists. See Element Should Be Visible for more information about visibility and supported arguments. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Should Not Contain 元素不該該包含 | locator, expected, message=None,ignore_case=False | 驗證該元素 該 該
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Text Should Be 元素文本應該是 | locator, expected, message=None,ignore_case=False | 驗證該元素是否 該 該
若是須要子字符串匹配,則使用元素應包含。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Element Text Should Not Be 元素文本不該該 | locator, not_expected, message=None,ignore_case=False | 驗證該元素 該 該 SeleniumLibrary 3.1.1中的新功能 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Execute Async Javascript 執行異步Javascript | *code | 執行異步JavaScript代碼。 與Execute Javascript相似,不一樣之處在於使用此關鍵字執行的腳本必須經過調用提供的回調明確表示它們已完成。此回調始終做爲最後一個參數注入到執行的函數中。 腳本必須在腳本超時內完成,不然此關鍵字將失敗。有關詳細信息,請參閱超時部分。 Examples:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Execute Javascript 執行Javascript | *code | 執行給定的JavaScript代碼。
若是 JavaScript在當前選定的框架或窗口的上下文中執行,做爲匿名函數的主體。用 此關鍵字返回執行的JavaScript代碼返回的任何內容。返回值將轉換爲適當的Python類型。 Examples:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Focus | locator | 已過期. Use Set Focus To Element instead. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Frame Should Contain 框架應該包含 | locator, text, loglevel=INFO | 驗證由 See Page Should Contain for explanation about the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Alert Message 獲取提醒消息 | dismiss=True | 過期. Use Handle Alert instead. Returns the message the alert has. Dismisses the alert by default (i.e. presses Handle Alert has better support for controlling should the alert be accepted, dismissed, or left open. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get All Links 獲取全部連接 | 返回包含當前頁面中找到的全部連接的ID的列表。 若是連接沒有id,則列表中將出現一個空字符串 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Cookie | name | Returns information of cookie with If no cookie is found with
See the WebDriver specification for details about the cookie information. Notice that Example:
New in SeleniumLibrary 3.0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Cookie Value | name | Deprecated. Use Get Cookie instead. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Cookies | Returns all cookies of the current page. The cookie information is returned as a single string in format |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Element Attribute | locator, attribute=None | Returns value of See the Locating elements section for details about the locator syntax. Example:
Passing attribute name as part of the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Element Count | locator | Returns number of elements matching If you wish to assert the number of matching elements, use Page Should Contain Element with Example:
New in SeleniumLibrary 3.0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Element Size | locator | Returns width and height of element identified by See the Locating elements section for details about the locator syntax. Both width and height are returned as integers. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Horizontal Position | locator | Returns horizontal position of element identified by See the Locating elements section for details about the locator syntax. The position is returned in pixels off the left side of the page, as an integer. See also Get Vertical Position. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get List Items | locator, values=False | Returns all labels or values of selection list See the Locating elements section for details about the locator syntax. Returns visible labels by default, but values can be returned by setting the Example:
Support to return values is new in SeleniumLibrary 3.0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Location | Returns the current browser URL. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Locations | Returns and logs URLs of all known browser windows. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Matching Xpath Count | xpath, return_str=True | Deprecated. Use Get Element Count instead. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Selected List Label | locator | Returns label of selected option from selection list If there are multiple selected options, label of the first option is returned. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Selected List Labels | locator | Returns labels of selected options from selection list Starting from SeleniumLibrary 3.0, returns an empty list if there are no selections. In earlier versions this caused an error. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Selected List Value | locator | Returns value of selected option from selection list If there are multiple selected options, value of the first option is returned. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Selected List Values | locator | Returns values of selected options from selection list Starting from SeleniumLibrary 3.0, returns an empty list if there are no selections. In earlier versions this caused an error. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Selenium Implicit Wait | Gets the implicit wait value used by Selenium. The value is returned as a human readable string like See the Implicit wait section above for more information. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Selenium Speed | Gets the delay that is waited after each Selenium command. The value is returned as a human readable string like See the Selenium Speed section above for more information. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Selenium Timeout | Gets the timeout that is used by various keywords. The value is returned as a human readable string like See the Timeout section above for more information. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Source | Returns the entire HTML source of the current page or frame. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Table Cell | locator, row, column, loglevel=INFO | Returns contents of table cell. The table is located using the Both row and column indexes start from 1, and header and footer rows are included in the count. It is possible to refer to rows and columns from the end by using negative indexes so that -1 is the last row/column, -2 is the second last, and so on. All See Page Should Contain for explanation about the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Text | locator | Returns the text value of element identified by See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Title | Returns the title of current page. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Value | locator | Returns the value attribute of element identified by See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Vertical Position | locator | Returns vertical position of element identified by See the Locating elements section for details about the locator syntax. The position is returned in pixels off the top of the page, as an integer. See also Get Horizontal Position. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get WebElement | locator | Returns the first WebElement matching the given See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get WebElements | locator | Returns list of WebElement objects matching the See the Locating elements section for details about the locator syntax. Starting from SeleniumLibrary 3.0, the keyword returns an empty list if there are no matching elements. In previous releases the keyword failed in this case. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Window Handles | Return all current window handles as a list. Can be used as a list of windows to exclude with Select Window. Prior to SeleniumLibrary 3.0, this keyword was named List Windows. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Window Identifiers | Returns and logs id attributes of all known browser windows. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Window Names | Returns and logs names of all known browser windows. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Window Position | Returns current window position. Position is relative to the top left corner of the screen. Returned values are integers. See also Set Window Position. Example:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Window Size | Returns current window width and height as integers. See also Set Window Size. Example:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Window Titles | Returns and logs titles of all known browser windows. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Go Back | Simulates the user clicking the back button on their browser. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Go To | url | Navigates the active browser instance to the provided |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Handle Alert | action=ACCEPT, timeout=None | Handles the current alert and returns its message. By default the alert is accepted, but this can be controlled with the
The Examples:
New in SeleniumLibrary 3.0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input Password | locator, password | Types the given password into text field identified by See the Locating elements section for details about the locator syntax. Difference compared to Input Text is that this keyword does not log the given password on the INFO level. Notice that if you use the keyword like
the password is shown as a normal keyword argument. A way to avoid that is using variables like
Notice also that SeleniumLibrary logs all the communication with browser drivers using the DEBUG level, and the actual password can be seen there. Additionally Robot Framework logs all arguments using the TRACE level. Tests must thus not be executed using level below INFO if password should not be logged in any format. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input Text | locator, text | Types the given Use Input Password if you do not want the given See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input Text Into Alert | text, action=ACCEPT, timeout=None | Types the given The alert is accepted by default, but that behavior can be controlled by using the
New in SeleniumLibrary 3.0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input Text Into Prompt | text | Deprecated. Use Input Text Into Alert instead. Types the given |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
List Selection Should Be | locator, *expected | Verifies selection list It is possible to give expected options both as visible labels and as values. Starting from SeleniumLibrary 3.0, mixing labels and values is not possible. Order of the selected options is not validated. If no expected options are given, validates that the list has no selections. A more explicit alternative is using List Should Have No Selections. See the Locating elements section for details about the locator syntax. Examples:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
List Should Have No Selections | locator | Verifies selection list See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
List Windows | Deprecated. Use Get Window Handles instead. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Location Should Be | url | Verifies that current URL is exactly |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Location Should Contain | expected | Verifies that current URL contains |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Locator Should Match X Times | locator, x, message=None,loglevel=INFO | Deprecated, use Page Should Contain Element with |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Log Location | Logs and returns the current URL. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Log Source | loglevel=INFO | Logs and returns the HTML source of the current page or frame. The |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Log Title | Logs and returns the title of current page. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Maximize Browser Window | Maximizes current browser window. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Mouse Down | locator | Simulates pressing the left mouse button on the element See the Locating elements section for details about the locator syntax. The element is pressed without releasing the mouse button. See also the more specific keywords Mouse Down On Image and Mouse Down On Link. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Mouse Down On Image | locator | Simulates a mouse down event on an image identified by See the Locating elements section for details about the locator syntax. When using the default locator strategy, images are searched using |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Mouse Down On Link | locator | Simulates a mouse down event on a link identified by See the Locating elements section for details about the locator syntax. When using the default locator strategy, links are searched using |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Mouse Out | locator | Simulates moving mouse away from the element See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Mouse Over | locator | Simulates hovering mouse over the element See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Mouse Up | locator | Simulates releasing the left mouse button on the element See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Open Browser | url, browser=firefox, alias=None,remote_url=False,desired_capabilities=None,ff_profile_dir=None | Opens a new browser instance to the given The
To be able to actually use one of these browsers, you need to have a matching Selenium browser driver available. See the project documentation for more details. Headless Firefox and Headless Chrome are new additions in SeleniumLibrary 3.1.0 and require Selenium 3.8.0 or newer. Optional Optional Optional Optional Examples:
If the provided configuration options are not enough, it is possible to use Create Webdriver to customize browser initialization even more. Applying |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Open Context Menu | locator | Opens context menu on element identified by |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain | text, loglevel=INFO | Verifies that current page contains If this keyword fails, it automatically logs the page source using the log level specified with the optional |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain Button | locator, message=None, loglevel=INFO | Verifies button See Page Should Contain Element for explanation about See the Locating elements section for details about the locator syntax. When using the default locator strategy, buttons are searched using |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain Checkbox | locator, message=None, loglevel=INFO | Verifies checkbox See Page Should Contain Element for explanation about See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain Element | locator, message=None, loglevel=INFO,limit=None | Verifies that element See the Locating elements section for details about the locator syntax. The The See Page Should Contain for explanation about the Examples assumes that locator matches to two elements.
The |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain Image | locator, message=None, loglevel=INFO | Verifies image identified by See the Locating elements section for details about the locator syntax. When using the default locator strategy, images are searched using See Page Should Contain Element for explanation about |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain Link | locator, message=None, loglevel=INFO | Verifies link identified by See the Locating elements section for details about the locator syntax. When using the default locator strategy, links are searched using See Page Should Contain Element for explanation about |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain List | locator, message=None, loglevel=INFO | Verifies selection list See Page Should Contain Element for explanation about See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain Radio Button | locator, message=None, loglevel=INFO | Verifies radio button See Page Should Contain Element for explanation about See the Locating elements section for details about the locator syntax. When using the default locator strategy, radio buttons are searched using |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Contain Textfield | locator, message=None, loglevel=INFO | Verifies text field See Page Should Contain Element for explanation about See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain | text, loglevel=INFO | Verifies the current page does not contain See Page Should Contain for explanation about the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain Button | locator, message=None, loglevel=INFO | Verifies button See Page Should Contain Element for explanation about See the Locating elements section for details about the locator syntax. When using the default locator strategy, buttons are searched using |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain Checkbox | locator, message=None, loglevel=INFO | Verifies checkbox See Page Should Contain Element for explanation about See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain Element | locator, message=None, loglevel=INFO | Verifies that element See the Locating elements section for details about the locator syntax. See Page Should Contain for explanation about |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain Image | locator, message=None, loglevel=INFO | Verifies image identified by See the Locating elements section for details about the locator syntax. When using the default locator strategy, images are searched using See Page Should Contain Element for explanation about |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain Link | locator, message=None, loglevel=INFO | Verifies link identified by See the Locating elements section for details about the locator syntax. When using the default locator strategy, links are searched using See Page Should Contain Element for explanation about |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain List | locator, message=None, loglevel=INFO | Verifies selection list See Page Should Contain Element for explanation about See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain Radio Button | locator, message=None, loglevel=INFO | Verifies radio button See Page Should Contain Element for explanation about See the Locating elements section for details about the locator syntax. When using the default locator strategy, radio buttons are searched using |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Page Should Not Contain Textfield | locator, message=None, loglevel=INFO | Verifies text field See Page Should Contain Element for explanation about See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Press Key | locator, key | Simulates user pressing key on element identified by See the Locating elements section for details about the locator syntax.
Examples:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Radio Button Should Be Set To | group_name, value | Verifies radio button group
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Radio Button Should Not Be Selected | group_name | Verifies radio button group
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Register Keyword To Run On Failure | keyword | Sets the keyword to execute when a SeleniumLibrary keyword fails.
The initial keyword to use is set when importing the library, and the keyword that is used by default is Capture Page Screenshot. Taking a screenshot when something failed is a very useful feature, but notice that it can slow down the execution. It is possible to use string This keyword returns the name of the previously registered failure keyword or Python Example:
Changes in SeleniumLibrary 3.0:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Reload Page | Simulates user reloading page. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Remove Location Strategy | strategy_name | Removes a previously added custom location strategy. See Custom locators for information how to create and use custom strategies. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Select All From List | locator | Selects all options from multi-selection list See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Select Checkbox | locator | Selects checkbox identified by Does nothing if checkbox is already selected. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Select Frame | locator | Sets frame identified by See the Locating elements section for details about the locator syntax. Works both with frames and iframes. Use Unselect Frame to cancel the frame selection and return to the main frame. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Select From List | locator, *options | Deprecated. Use Select From List By Label/Value/Index instead. This keyword selects options based on labels or values, which makes it very complicated and slow. It has been deprecated in SeleniumLibrary 3.0, and dedicated keywords Select From List By Label, Select From List By Value and Select From List By Index should be used instead. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Select From List By Index | locator, *indexes | Selects options from selection list Indexes of list options start from 0. If more than one option is given for a single-selection list, the last value will be selected. With multi-selection lists all specified options are selected, but possible old selections are not cleared. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Select From List By Label | locator, *labels | Selects options from selection list If more than one option is given for a single-selection list, the last value will be selected. With multi-selection lists all specified options are selected, but possible old selections are not cleared. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Select From List By Value | locator, *values | Selects options from selection list If more than one option is given for a single-selection list, the last value will be selected. With multi-selection lists all specified options are selected, but possible old selections are not cleared. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Select Radio Button | group_name, value | Sets radio button group The radio button to be selected is located by two arguments:
Examples:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Select Window | locator=MAIN | Selects browser window matching If the window is found, all subsequent commands use the selected window, until this keyword is used again. If the window is not found, this keyword fails. The previous window handle is returned, and can be used to return back to it later. Notice that in this context window means a pop-up window opened when doing something on an existing window. It is not possible to select windows opened with Open Browser, Switch Browser must be used instead. Notice also that alerts should be handled with Handle Alert or other alert related keywords. The
Example:
NOTE:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Browser Implicit Wait | value | Sets the implicit wait value used by Selenium. Same as Set Selenium Implicit Wait but only affects the current browser. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Focus To Element | locator | Sets focus to element identified by See the Locating elements section for details about the locator syntax. Prior to SeleniumLibrary 3.0 this keyword was named Focus. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Screenshot Directory | path, persist=DEPRECATED | Sets the directory for captured screenshots.
The previous value is returned and can be used to restore the original value later if needed. Deprecating |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Selenium Implicit Wait | value | Sets the implicit wait value used by Selenium. The value can be given as a number that is considered to be seconds or as a human readable string like This keyword sets the implicit wait for all opened browsers. Use Set Browser Implicit Wait to set it only to the current browser. See the Implicit wait section above for more information. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Selenium Speed | value | Sets the delay that is waited after each Selenium command. The value can be given as a number that is considered to be seconds or as a human readable string like See the Selenium Speed section above for more information. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Selenium Timeout | value | Sets the timeout that is used by various keywords. The value can be given as a number that is considered to be seconds or as a human readable string like See the Timeout section above for more information. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Window Position | x, y | Sets window position using The position is relative to the top left corner of the screen, but some browsers exclude possible task bar set by the operating system from the calculation. The actual position may thus be different with different browsers. Values can be given using strings containing numbers or by using actual numbers. See also Get Window Position. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set Window Size | width, height | Sets current windows size to given Values can be given using strings containing numbers or by using actual numbers. See also Get Window Size. Browsers have a limit how small they can be set. Trying to set them smaller will cause the actual size to be bigger than the requested size. Example:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Simulate | locator, event | Deprecated. Use Simulate Event instead. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Simulate Event | locator, event | Simulates This keyword is useful if element has See the Locating elements section for details about the locator syntax. Prior to SeleniumLibrary 3.0 this keyword was named Simulate. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Submit Form | locator=None | Submits a form identified by If See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Switch Browser | index_or_alias | Switches between active browsers using Indices are returned by the Open Browser keyword and aliases can be given to it explicitly. Indices start from 1. Example:
Above example expects that there was no other open browsers when opening the first one because it used index
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table Cell Should Contain | locator, row, column, expected,loglevel=INFO | Verifies table cell contains text See Get Table Cell that this keyword uses internally for explanation about accepted arguments. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table Column Should Contain | locator, column, expected,loglevel=INFO | Verifies table column contains text The table is located using the Column indexes start from 1. It is possible to refer to columns from the end by using negative indexes so that -1 is the last column, -2 is the second last, and so on. If a table contains cells that span multiple columns, those merged cells count as a single column. See Page Should Contain Element for explanation about the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table Footer Should Contain | locator, expected, loglevel=INFO | Verifies table footer contains text Any The table is located using the See Page Should Contain Element for explanation about the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table Header Should Contain | locator, expected, loglevel=INFO | Verifies table header contains text Any The table is located using the See Page Should Contain Element for explanation about the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table Row Should Contain | locator, row, expected, loglevel=INFO | Verifies that table row contains text The table is located using the Row indexes start from 1. It is possible to refer to rows from the end by using negative indexes so that -1 is the last row, -2 is the second last, and so on. If a table contains cells that span multiple rows, a match only occurs for the uppermost row of those merged cells. See Page Should Contain Element for explanation about the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table Should Contain | locator, expected, loglevel=INFO | Verifies table contains text The table is located using the See Page Should Contain Element for explanation about the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Textarea Should Contain | locator, expected, message=None | Verifies text area
See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Textarea Value Should Be | locator, expected, message=None | Verifies text area
See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Textfield Should Contain | locator, expected, message=None | Verifies text field
See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Textfield Value Should Be | locator, expected, message=None | Verifies text field
See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Title Should Be | title, message=None | Verifies that current page title equals The
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unselect All From List | locator | Unselects all options from multi-selection list See the Locating elements section for details about the locator syntax. New in SeleniumLibrary 3.0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unselect Checkbox | locator | Removes selection of checkbox identified by Does nothing if the checkbox is not selected. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unselect Frame | Sets the main frame as the current frame. In practice cancels the previous Select Frame call. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unselect From List | locator, *items | Deprecated. Use Unselect From List By Label/Value/Index instead. This keyword unselects options based on labels or values, which makes it very complicated and slow. It has been deprecated in SeleniumLibrary 3.0, and dedicated keywords Unselect From List By Label, Unselect From List By Value and Unselect From List By Index should be used instead. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unselect From List By Index | locator, *indexes | Unselects options from selection list Indexes of list options start from 0. This keyword works only with multi-selection lists. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unselect From List By Label | locator, *labels | Unselects options from selection list This keyword works only with multi-selection lists. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unselect From List By Value | locator, *values | Unselects options from selection list This keyword works only with multi-selection lists. See the Locating elements section for details about the locator syntax. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait For Condition | condition, timeout=None, error=None | Waits until The condition can be arbitrary JavaScript expression but it must return a value to be evaluated. See Execute JavaScript for information about accessing content on pages. Fails if the timeout expires before the condition becomes true. See the Timeouts section for more information about using timeouts and their default value.
Examples:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Element Contains | locator, text, timeout=None,error=None | Waits until element Fails if
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Element Does Not Contain | locator, text, timeout=None,error=None | Waits until element Fails if
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Element Is Enabled | locator, timeout=None, error=None | Waits until element Element is considered enabled if it is not disabled nor read-only. Fails if
Considering read-only elements to be disabled is a new feature in SeleniumLibrary 3.0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Element Is Not Visible | locator, timeout=None, error=None | Waits until element Fails if
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Element Is Visible | locator, timeout=None, error=None | Waits until element Fails if
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Page Contains | text, timeout=None, error=None | Waits until Fails if
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Page Contains Element | locator, timeout=None, error=None | Waits until element Fails if
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Page Does Not Contain | text, timeout=None, error=None | Waits until Fails if
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wait Until Page Does Not Contain Element | locator, timeout=None, error=None | Waits until element Fails if
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Xpath Should Match X Times | xpath, x, message=None,loglevel=INFO | Deprecated, use Page Should Contain Element with |
關鍵詞 | 參數 | 文檔 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
添加Cookie | name, value, path = None, domain = None, secure = None, expiry = None | 在當前會話中添加cookie。
例:
在SeleniumLibrary 3.0設置到期以前不起做用。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
添加位置策略 | strategy_name, strategy_keyword, persist = False | 添加自定義位置策略。 有關如何建立和使用自定義策略的信息,請參閱自定義定位器。刪除位置策略可用於刪除已註冊的策略。 默認狀況下,在離開當前做用域後會自動刪除位置策略。設置 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
警報應該存在 | text =, action = ACCEPT, timeout = None | 驗證是否存在警報,而且默認狀況下接受警報。 若是沒有警報則失敗。若是
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
警報不該該存在 | action = ACCEPT, timeout = 0 | 驗證沒有警報。 若是警報確實存在,則
SeleniumLibrary 3.0中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
將Id分配給元素 | 定位器, 身份 | 將臨時分配 若是定位器是複雜的和/或緩慢的XPath表達式而且須要屢次,則這很是有用。標識符在從新加載頁面時到期。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
捕獲頁面截圖 | 文件名=硒 - screenshot- {索引} .PNG | 獲取當前頁面的屏幕截圖並將其嵌入到日誌文件中。
從SeleniumLibrary 1.8開始,若是 返回建立的屏幕截圖文件的絕對路徑。 例子:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
應選中複選框 | 定位器 |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
不該選中複選框 | 定位器 |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
選擇取消下次確認 | 已過期。請直接使用Handle Alert。 在SeleniumLibrary 3.0以前的版本中,須要在使用Confirm Action關鍵字以前單獨設置警報處理方法。New Handle Alert關鍵字接受如何將警報做爲普通參數處理的操做,應該使用它。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
選擇文件 | locator, file_path | 輸入 此關鍵字最經常使用於將文件輸入上載表單。指定的文件 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
選擇Ok On Next Confirmation | 已過期。請直接使用Handle Alert。 在SeleniumLibrary 3.0以前的版本中,須要在使用Confirm Action關鍵字以前單獨設置警報處理方法。New Handle Alert關鍵字接受如何將警報做爲普通參數處理的操做,應該使用它。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
清除元素文本 | 定位器 | 清除標識的文本輸入元素的值 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
單擊按鈕 | 定位器 | 點擊按鈕標識 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
單擊元素 | 定位器 | 單擊標識的元素 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
單擊座標處的元素 | 定位器, xoffset, yoffset | 點擊元素 移動光標,從該點計算元素的中心和x / y座標。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
單擊圖像 | 定位器 | 單擊標識的圖像 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
單擊連接 | 定位器 | 單擊標識的連接 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
關閉全部瀏覽器 | 關閉全部打開的瀏覽器並重置瀏覽器緩存。 在此關鍵字以後,從Open Browser關鍵字返回的新索引將重置爲1。 此關鍵字應在測試或套件拆解中使用,以確保全部瀏覽器都已關閉。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
關閉瀏覽器 | 關閉當前瀏覽器。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
關閉窗口 | 關閉當前打開的彈出窗口。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
確認行動 | 已過期。請改用Handle Alert。 默認狀況下,接受警報,但能夠經過選擇取消確認下一個確認並選擇肯定下一個確認關鍵字來更改此行爲。New Handle Alert關鍵字接受如何將警報做爲普通參數處理的操做,應該使用它。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
建立Webdriver | driver_name, alias = None, kwargs = {}, ** init_kwargs | 建立Selenium WebDriver的實例。 與Open Browser相似,但容許直接將參數傳遞給建立的WebDriver實例。僅當Open Browser提供的功能不足時,才應使用此關鍵字。
初始化的WebDriver可使用Python字典 例子:
返回此瀏覽器實例的索引,稍後可使用該索引切換回它。索引從1開始,並在使用Close All Browsers關鍵字時重置爲它。有關示例,請參閱Switch Browser。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
當前幀包含 | text, loglevel = INFO | 已過期。使用當前幀應該包含。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
當前框架應包含 | text, loglevel = INFO | 驗證當前幀是否包含 有關參數的說明,請參見頁面應包含 在SeleniumLibrary 3.0以前,此關鍵字被命名爲Current Frame Contains。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
當前框架不該包含 | text, loglevel = INFO | 驗證當前幀是否包含 有關參數的說明,請參見頁面應包含 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
刪除全部Cookie | 刪除全部cookie。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
刪除Cookie | 名稱 | 刪除cookie匹配 若是找不到cookie,則沒有任何反應。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
解僱警報 | 接受=真 | 已過期。請改用Handle Alert。 與其名稱相反,此關鍵字默認接受警報(即按下 若是警報被接受,解僱或保持開放,則處理警報能夠更好地支持控制。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
雙擊元素 | 定位器 | 雙擊標識的元素 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
拖放 | 定位器, 目標 | drags元素由 該 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
經過偏移拖放 | 定位器, xoffset, yoffset | 拖拽元素 元素將被移動, 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素應該被禁用 | 定位器 | 驗證標識的元素 此關鍵字還會考慮禁用只讀的元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
應該啓用元素 | 定位器 | 驗證 此關鍵字還會考慮禁用只讀的元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素應該集中 | 定位器 | 驗證標識的元素 SeleniumLibrary 3.0中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素應該是可見的 | locator, message =無 | 驗證標識的元素 這裏,visible表示該元素在邏輯上可見,在當前瀏覽器視口中不是光學可見的。例如,攜帶的元素在 該 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素應該包含 | locator, expected, message = None, ignore_case = False | 驗證該元素是否 該 該
若是要匹配確切的文本而不是子字符串,則應使用元素文本。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素不該該是可見的 | locator, message =無 | 驗證標識的元素 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素不該該包含 | locator, expected, message = None, ignore_case = False | 驗證該元素 該 該
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素文本應該是 | locator, expected, message = None, ignore_case = False | 驗證該元素是否 該 該
若是須要子字符串匹配,則使用元素應包含。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
元素文本不該該 | locator, not_expected, message = None, ignore_case = False | 驗證該元素 該 該 SeleniumLibrary 3.1.1中的新功能 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
執行異步Javascript | *碼 | 執行異步JavaScript代碼。 與Execute Javascript相似,不一樣之處在於使用此關鍵字執行的腳本必須經過調用提供的回調明確表示它們已完成。此回調始終做爲最後一個參數注入到執行的函數中。 腳本必須在腳本超時內完成,不然此關鍵字將失敗。有關詳細信息,請參閱超時部分。 例子:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
執行Javascript | *碼 | 執行給定的JavaScript代碼。
若是 JavaScript在當前選定的框架或窗口的上下文中執行,做爲匿名函數的主體。用 此關鍵字返回執行的JavaScript代碼返回的任何內容。返回值將轉換爲適當的Python類型。 例子:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
焦點 | 定位器 | 已過期。請改成使用Set Focus To Element。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
框架應該包含 | locator, text, loglevel = INFO | 驗證由 有關參數的說明,請參見頁面應包含 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取提醒消息 | 解僱=真 | 已過期。請改用Handle Alert。 返回警報的消息。默認狀況下解除警報(即按下 若是警報被接受,解僱或保持開放,則處理警報能夠更好地支持控制。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取全部連接 | 返回包含當前頁面中找到的全部連接的ID的列表。 若是連接沒有id,則列表中將出現一個空字符串。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取Cookie | 名稱 |
若是未找到cookie
有關cookie信息的詳細信息,請參閱WebDriver規範。請注意,它 例:
SeleniumLibrary 3.0中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取Cookie值 | 名稱 | 已過期。請改用Get Cookie。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取Cookies | 返回當前頁面的全部cookie。 cookie信息以格式的單個字符串形式返回 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取元素屬性 | locator, attribute = None | 返回 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取元素計數 | 定位器 | 返回匹配的元素數 若是要聲明匹配元素的數量,請使用Page should Contain Element with 例:
SeleniumLibrary 3.0中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取元素大小 | 定位器 | 返回由標識的元素的寬度和高度 寬度和高度都以整數形式返回。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
得到橫向位置 | 定位器 | 返回由標識的元素的水平位置 位置以頁面左側的像素爲單位返回,爲整數。 另請參閱獲取垂直位置。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取列表項 | locator, values = False | 返回選擇列表的全部標籤或值 默認狀況下返回可見標籤,但能夠經過將 例:
支持返回值是SeleniumLibrary 3.0中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取位置 | 返回當前的瀏覽器URL。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取地點 | 返回並記錄全部已知瀏覽器窗口的URL。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取匹配的Xpath計數 | xpath, return_str = True | 已過期。請改用「 獲取元素計數」。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取選定的列表標籤 | 定位器 | 從選擇列表返回所選選項的標籤 若是有多個選定選項,則返回第一個選項的標籤。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取選定列表標籤 | 定位器 | 從選擇列表返回所選選項的標籤 從SeleniumLibrary 3.0開始,若是沒有選擇,則返回一個空列表。在早期版本中,這會致使錯誤。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取選定的列表值 | 定位器 | 從選擇列表返回所選選項的值 若是有多個選定選項,則返回第一個選項的值。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取選定的列表值 | 定位器 | 從選擇列表返回所選選項的值 從SeleniumLibrary 3.0開始,若是沒有選擇,則返回一個空列表。在早期版本中,這會致使錯誤。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取Selenium Implicit Wait | 獲取Selenium使用的隱式等待值。 該值做爲人類可讀的字符串返回 有關詳細信息,請參閱上面的隱式等待部分。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
得到Selenium Speed | 獲取每一個Selenium命令後等待的延遲。 該值做爲人類可讀的字符串返回 有關詳細信息,請參閱上面的Selenium Speed部分。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取Selenium Timeout | 獲取各類關鍵字使用的超時。 該值做爲人類可讀的字符串返回 有關詳細信息,請參閱上面的超時部分。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取來源 | 返回當前頁面或框架的整個HTML源。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取表格單元格 | 定位器, 行, 列, loglevel = INFO | 返回表格單元格的內容。 使用 行索引和列索引都從1開始,頁眉和頁腳行包含在計數中。能夠經過使用負索引從末尾引用行和列,以便-1是最後一行/列,-2是最後一行,依此類推。 全部 有關參數的說明,請參見頁面應包含 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取文字 | 定位器 | 返回由標識的元素的文本值 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
得到標題 | 返回當前頁面的標題。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
得到價值 | 定位器 | 返回由標識的元素的value屬性 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
得到垂直位置 | 定位器 | 返回由標識的元素的垂直位置 位置以頁面頂部的像素爲單位返回,做爲整數。 另請參見獲取水平位置。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取WebElement | 定位器 | 返回與給定匹配的第一個WebElement |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取WebElements | 定位器 | 返回與之匹配的WebElement對象列表 從SeleniumLibrary 3.0開始,若是沒有匹配的元素,關鍵字將返回一個空列表。在之前的版本中,關鍵字在這種狀況下失敗。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取窗口句柄 | 將全部當前窗口句柄做爲列表返回。 能夠用做要使用選擇窗口排除的窗口列表。 在SeleniumLibrary 3.0以前,此關鍵字被命名爲List Windows。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取窗口標識符 | 返回並記錄全部已知瀏覽器窗口的id屬性。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取窗口名稱 | 返回並記錄全部已知瀏覽器窗口的名稱。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取窗口位置 | 返回當前窗口位置。 位置相對於屏幕的左上角。返回值是整數。另請參見設置窗口位置。 例:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取窗口大小 | 以整數形式返回當前窗口寬度和高度。 另請參見設置窗口大小。 例:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
獲取窗口標題 | 返回並記錄全部已知瀏覽器窗口的標題。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
回去 | 模擬用戶單擊其瀏覽器上的後退按鈕。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
去 | 網址 | 將活動的瀏覽器實例導航到提供的實例 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
處理警報 | action = ACCEPT, timeout = None | 處理當前警報並返回其消息。 默認狀況下,接受警報,但可使用
該 例子:
SeleniumLibrary 3.0中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
輸入密碼 | 定位器, 密碼 | 將給定密碼鍵入標識的文本字段 與輸入文本相比的差別是此關鍵字不會在INFO級別上記錄給定的密碼。請注意,若是您使用關鍵字like
密碼顯示爲普通關鍵字參數。避免這種狀況的一種方法是使用像
另請注意,SeleniumLibrary使用DEBUG級別記錄與瀏覽器驅動程序的全部通訊,而且能夠在那裏看到實際密碼。此外,Robot Framework使用TRACE級別記錄全部參數。所以,若是不以任何格式記錄密碼,則必須使用低於INFO的級別執行測試。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
輸入文本 | 定位器, 文本 | 將給定的 若是您不但願記錄給定,請使用輸入密碼 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
將文本輸入警報 | text, action = ACCEPT, timeout = None | 將給定類型 默認狀況下接受警報,但可使用
SeleniumLibrary 3.0中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
將文本輸入到提示中 | 文本 | 已過期。請改用輸入文本到警報。 將給定類型 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
列表選擇應該是 | 定位器, *預期 | 驗證選擇列表 能夠將預期選項做爲可見標籤和值給出。從SeleniumLibrary 3.0開始,沒法混合標籤和值。未驗證所選選項的順序。 若是未給出預期選項,則驗證列表沒有選擇。更明確的替代方案是使用列表應該沒有選擇。 例子:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
列表應該沒有選擇 | 定位器 | 驗證選擇列表 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
列出Windows | 已過期。請改用「 獲取窗口句柄」。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
位置應該是 | 網址 | 驗證當前URL是否徹底正確 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
位置應該包含 | 預期 | 驗證當前URL是否包含 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
定位器應該匹配X次 | locator, x, message = None, loglevel = INFO | 不推薦使用,請使用Page should Contain Element with |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
記錄位置 | 記錄並返回當前URL。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
日誌源 | 記錄等級= INFO | 記錄並返回當前頁面或框架的HTML源。 該 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
日誌標題 | 記錄並返回當前頁面的標題。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
最大化瀏覽器窗口 | 最大化當前瀏覽器窗口。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
鼠標向下 | 定位器 | 模擬按下元素上的鼠標左鍵 按下元素而不釋放鼠標按鈕。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
鼠標在圖像上 | 定位器 | 在由標識的圖像上模擬鼠標按下事件 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
鼠標按下連接 | 定位器 | 在由標識的連接上模擬鼠標按下事件 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
鼠標移出 | 定位器 | 模擬將鼠標移離元素 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
鼠標移到 | 定位器 | 模擬將鼠標懸停在元素上 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
鼠標向上 | 定位器 | 模擬釋放元素上的鼠標左鍵 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
打開瀏覽器 | url, browser = firefox, alias = None, remote_url = False,desired_capabilities = None, ff_profile_dir = None | 打開給定的新瀏覽器實例 該
爲了可以實際使用這些瀏覽器之一,您須要提供匹配的Selenium瀏覽器驅動程序。有關詳細信息,請參閱項目文檔。Headless Firefox和Headless Chrome是SeleniumLibrary 3.1.0中的新增功能,須要Selenium 3.8.0或更新版本。 可選 可選 可選 可選的 例子:
若是提供的配置選項不夠,則可使用Create Webdriver進一步自定義瀏覽器初始化。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
打開上下文菜單 | 定位器 | 在標識的元素上打開上下文菜單 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面應該包含 | text, loglevel = INFO | 驗證當前頁面是否包含 若是此關鍵字失敗,它將使用使用optional |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面應包含按鈕 | locator, message = None, loglevel = INFO |
有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面應包含複選框 | locator, message = None, loglevel = INFO |
有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面應包含元素 | locator, message = None, loglevel = INFO, limit = None | 驗證 該 該 有關參數的說明,請參見頁面應包含 示例假定定位器與兩個元素匹配。
這個 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面應包含圖像 | locator, message = None, loglevel = INFO | 驗證 有關定位器語法的詳細信息,請參閱定位元素部分。當使用默認的定位策略,圖像是使用搜索 有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面應包含連接 | locator, message = None, loglevel = INFO | 驗證 有關定位器語法的詳細信息,請參閱定位元素部分。當使用默認的定位策略,連接使用搜索 有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面應包含列表 | locator, message = None, loglevel = INFO | 驗證 有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面應包含單選按鈕 | locator, message = None, loglevel = INFO |
有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面應包含文本字段 | locator, message = None, loglevel = INFO | 驗證 有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面不該該包含 | text, loglevel = INFO | 驗證當前頁面不包含 有關參數的說明,請參見頁面應包含 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面不該包含按鈕 | locator, message = None, loglevel = INFO |
有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面不該包含複選框 | locator, message = None, loglevel = INFO |
有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面不該包含元素 | locator, message = None, loglevel = INFO | 驗證 有關和參數的說明,請參見頁面應包含。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面不該包含圖像 | locator, message = None, loglevel = INFO | 驗證 有關定位器語法的詳細信息,請參閱定位元素部分。當使用默認的定位策略,圖像是使用搜索 有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面不該包含連接 | locator, message = None, loglevel = INFO | 驗證 有關定位器語法的詳細信息,請參閱定位元素部分。當使用默認的定位策略,連接使用搜索 有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面不該包含列表 | locator, message = None, loglevel = INFO | 驗證 有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面不該包含單選按鈕 | locator, message = None, loglevel = INFO |
有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
頁面不該包含文本字段 | locator, message = None, loglevel = INFO | 驗證 有關和參數的說明,請參見頁面應包含元素。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
按鍵 | 定位器, 關鍵 | 模擬用戶按下標識的元素上的鍵
例子:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
單選按鈕應設置爲 | group_name, value | 驗證單選按鈕組
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
不該選擇單選按鈕 | 團隊名字 | 驗證單選按鈕組
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
註冊關鍵字以在失敗時運行 | 關鍵詞 | 設置SeleniumLibrary關鍵字失敗時要執行的關鍵字。
導入庫時設置要使用的初始關鍵字,默認狀況下使用的關鍵字是Capture Page Screenshot。在出現故障時拍攝屏幕截圖是一個很是有用的功能,但請注意它能夠減慢執行速度。 可使用字符串
例:
SeleniumLibrary 3.0的變化:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從新加載頁面 | 模擬用戶從新加載頁面。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
刪除位置策略 | STRATEGY_NAME | 刪除之前添加的自定義位置策略。 有關如何建立和使用自定義策略的信息,請參閱自定義定位器。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從列表中選擇所有 | 定位器 | 從多選列表中選擇全部選項 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
選擇複選框 | 定位器 | 選擇標識的複選框 若是已選中複選框則不執行任何操做 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
選擇框架 | 定位器 | 設置由 適用於框架和iframe。使用取消選擇框取消幀選擇並返回主框架。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從列表中選擇 | 定位器, *選項 | 已過期。使用從標籤/值/索引按列表選擇。 此關鍵字根據標籤或值選擇選項,這使得它很是複雜和緩慢。它已經在SeleniumLibrary 3.0被棄用,而專用的關鍵字從列表中選擇按標籤,從列表中選擇按值,並從列表中選擇按索引應改成使用。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從索引列表中選擇 | 定位器, *索引 | 選擇從選擇列表中選擇 列表選項的索引從0開始。 若是爲單選列表指定了多個選項,則將選擇最後一個值。使用多選列表,將選擇全部指定的選項,但不會清除可能的舊選擇。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從標籤列表中選擇 | 定位器, *標籤 | 選擇從選擇列表中選擇 若是爲單選列表指定了多個選項,則將選擇最後一個值。使用多選列表,將選擇全部指定的選項,但不會清除可能的舊選擇。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從按值列出中選擇 | 定位器, *值 | 選擇從選擇列表中選擇 若是爲單選列表指定了多個選項,則將選擇最後一個值。使用多選列表,將選擇全部指定的選項,但不會清除可能的舊選擇。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
選擇單選按鈕 | group_name, value | 將單選按鈕組設置 要選擇的單選按鈕由兩個參數定位:
例子:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
選擇窗口 | 定位符= MAIN | 選擇瀏覽器窗口匹配 若是找到該窗口,則全部後續命令都將使用所選窗口,直到再次使用此關鍵字。若是找不到該窗口,則此關鍵字將失敗。返回前一個窗口句柄,可用於稍後返回。 請注意,在此上下文窗口中表示在現有窗口上執行某些操做時打開的彈出窗口。沒法選擇使用Open Browser打開的窗口,必須使用Switch Browser。另請注意,應使用Handle Alert或其餘與警報相關的關鍵字處理警報。 該
例:
注意:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
設置瀏覽器隱式等待 | 值 | 設置Selenium使用的隱式等待值。 與Set Selenium Implicit Wait相同,但僅影響當前瀏覽器。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
將焦點設置爲元素 | 定位器 | 將焦點設置爲標識的元素 在SeleniumLibrary 3.0以前,這個關鍵字被命名爲Focus。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
設置截屏目錄 | path, persist = DEPRECATED | 設置捕獲的屏幕截圖的目錄。
返回前一個值,能夠在之後根據須要恢復原始值。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
設置Selenium Implicit Wait | 值 | 設置Selenium使用的隱式等待值。 該值能夠做爲被認爲是秒的數字給出,或者做爲人類可讀的字符串給出 此關鍵字設置全部已打開瀏覽器的隱式等待。使用Set Browser Implicit Wait將其設置爲僅當前瀏覽器。 有關詳細信息,請參閱上面的隱式等待部分。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
設置Selenium Speed | 值 | 設置每一個Selenium命令後等待的延遲。 該值能夠做爲被認爲是秒的數字給出,或者做爲人類可讀的字符串給出 有關詳細信息,請參閱上面的Selenium Speed部分。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
設置Selenium Timeout | 值 | 設置各類關鍵字使用的超時。 該值能夠做爲被認爲是秒的數字給出,或者做爲人類可讀的字符串給出 有關詳細信息,請參閱上面的超時部分。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
設置窗口位置 | x, y | 使用 該位置相對於屏幕的左上角,但某些瀏覽器排除了操做系統從計算中設置的可能任務欄。所以,實際位置可能因不一樣瀏覽器而不一樣。 可使用包含數字的字符串或使用實際數字來給出值。另請參見獲取窗口位置。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
設置窗口大小 | 寬度, 高度 | 將當前窗口大小設置爲給定 可使用包含數字的字符串或使用實際數字來給出值。另請參閱獲取窗口大小。 瀏覽器限制了它們的設置。嘗試將它們設置得更小將致使實際大小大於請求的大小。 例:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
模擬 | 定位器, 事件 | 已過期。請改用模擬事件。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
模擬事件 | 定位器, 事件 | 模擬 若是element具備 在SeleniumLibrary 3.0以前,這個關鍵字被命名爲Simulate。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
提交表格 | 定位器=無 | 提交由...標識的表格 若是 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
切換瀏覽器 | index_or_alias | 在活動瀏覽器之間切換 Open Browser關鍵字返回索引,而且能夠顯式地爲其指定別名。指數從1開始。 例:
上面的示例預計在打開第一個瀏覽器時沒有其餘打開的瀏覽器,由於它
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
表格單元格應該包含 | locator, row, column, expected, loglevel = INFO | 驗證表格單元格包含文本 有關已接受參數的說明,請參閱此關鍵字在內部使用的獲取表單元 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
表列應包含 | locator, column, expected, loglevel = INFO | 驗證表列包含文本 該表使用 列索引從1開始。可使用負索引從末尾引用列,以便-1是最後一列,-2是最後一列,依此類推。 若是表包含跨多個列的單元格,則這些合併的單元格將計爲單個列。 有關參數的說明,請參見Page Should Contain Element |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
表頁腳應該包含 | locator, expected, loglevel = INFO | 驗證表格頁腳包含文本
該表使用 有關參數的說明,請參見Page Should Contain Element |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
表頭應該包含 | locator, expected, loglevel = INFO | 驗證表頭包含文本
該表使用 有關參數的說明,請參見Page Should Contain Element |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
錶行應包含 | locator, row, expected, loglevel = INFO | 驗證錶行包含文本 該表使用 行索引從1開始。可使用負索引從末尾引用行,以便-1是最後一行,-2是最後一行,依此類推。 若是表包含跨越多行的單元格,則僅對這些合併單元格的最上一行進行匹配。 有關參數的說明,請參見Page Should Contain Element |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
表應該包含 | locator, expected, loglevel = INFO | 驗證表包含文本 該表使用 有關參數的說明,請參見Page Should Contain Element |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Textarea應該包含 | locator, expected, message =無 | 驗證文本區域
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Textarea值應該是 | locator, expected, message =無 | 驗證文本區域
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Textfield應該包含 | locator, expected, message =無 | 驗證文本字段
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
應該是Textfield值 | locator, expected, message =無 | 驗證文本字段
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
標題應該是 | 標題, 消息=無 | 驗證當前頁面標題是否等於 該
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從列表中取消選擇所有 | 定位器 | 取消選擇多選列表中的全部選項 SeleniumLibrary 3.0中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
取消選中複選框 | 定位器 | 刪除選中的複選框 若是未選中該複選框,則不執行任何操做 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
取消選擇框架 | 將主框架設置爲當前框架。 實際上取消了以前的Select Frame調用。 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從列表中取消選擇 | 定位器, *項目 | 已過期。使用取消選擇標籤/值/索引列表。 此關鍵字根據標籤或值取消選擇選項,這使得它很是複雜和緩慢。它已經在SeleniumLibrary 3.0被棄用,專用關鍵字取消選擇從列表按標籤,取消選擇從列表按值並取消選擇從列表按索引應改成使用。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從索引列表中取消選擇 | 定位器, *索引 | 從選擇列表中取消選擇選項 列表選項的索引從0開始。此關鍵字僅適用於多選列表。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從標籤列表中取消選擇 | 定位器, *標籤 | 從選擇列表中取消選擇選項 此關鍵字僅適用於多選列表。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
從值列表中取消選擇 | 定位器, *值 | 從選擇列表中取消選擇選項 此關鍵字僅適用於多選列表。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等待條件 | condition, timeout = None, error = None | 等待直到 條件能夠是任意JavaScript表達式,但必須返回要評估的值。有關訪問頁面上的內容的信息,請參閱執行JavaScript。 若是超時在條件變爲真以前到期,則失敗。有關使用超時及其默認值的詳細信息,請參閱超時部分。
例子:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到元素包含 | locator, text, timeout = None, error = None | 等到元素 若是
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到元素不包含 | locator, text, timeout = None, error = None | 等到元素 若是
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到元素啓用 | locator, timeout =無, 錯誤=無 | 等待元素 若是元素未禁用或只讀,則認爲元素已啓用。 若是
考慮要禁用的只讀元素是SeleniumLibrary 3.0中的新功能。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到元素不可見 | locator, timeout =無, 錯誤=無 | 等到元素 若是
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到元素可見 | locator, timeout =無, 錯誤=無 | 等到元素 若是
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到頁面包含 | text, timeout = None, error = None | 等到 若是
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到頁面包含元素 | locator, timeout =無, 錯誤=無 | 等到元素 若是
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到頁面不包含 | text, timeout = None, error = None | 等待直到 若是
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
等到頁面不包含元素 | locator, timeout =無, 錯誤=無 | 等待元素 若是
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Xpath應該匹配X次 | xpath, x, message = None, loglevel = INFO | 不推薦使用,請使用Page should Contain Element with |