Selenium2Library 英文api

    xiaoxiao2021-12-14  19

    Opening library documentation failed

    Verify that you have JavaScript enabled in your browser.Make sure you are using a modern enough browser. Firefox 3.5, IE 8, or equivalent is required, newer browsers are recommended.Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.

    Selenium2Library

    Library version:1.8.0Library scope:globalNamed arguments:supported

    Introduction

    Selenium2Library is a web testing library for Robot Framework.

    It uses the Selenium 2 (WebDriver) libraries internally to control a web browser. Seehttp://seleniumhq.org/docs/03_webdriver.html for more information on Selenium 2 and WebDriver.

    Selenium2Library runs tests in a real browser instance. It should work in most modern browsers and can be used with both Python and Jython interpreters.

    Before running tests

    Prior to running test cases using Selenium2Library, Selenium2Library must be imported into your Robot test suite (seeimporting section), and the Open Browser keyword must be used to open a browser to the desired location.

    --- Note important change starting with Version 1.7.0 release ---

    Locating or specifying elements

    All keywords in Selenium2Library that need to find an element on the page take an argument, either alocator or now a webelement. locator is a string that describes how to locate an element using a syntax specifying different location strategies.webelement is a variable that holds a WebElement instance, which is a representation of the element.

    Using locators


    By default, when a locator value is provided, it is matched against the key attributes of the particular element type. For example,id and name are key attributes to all elements, and locating elements is easy using just theid as a locator. For example:

    Click Element my_element

    It is also possible to specify the approach Selenium2Library should take to find an element by specifying a lookup strategy with a locator prefix. Supported strategies are:

    StrategyExampleDescriptionidentifierClick Element | identifier=my_elementMatches by @id or @name attributeidClick Element | id=my_elementMatches by @id attributenameClick Element | name=my_elementMatches by @name attributexpathClick Element | xpath=//div[@id='my_element']Matches with arbitrary XPath expressiondomClick Element | dom=document.images[56]Matches with arbitrary DOM expresslinkClick Element | link=My LinkMatches anchor elements by their link textpartial linkClick Element | partial link=y LinMatches anchor elements by their partial link textcssClick Element | css=div.my_classMatches by CSS selectorjqueryClick Element | jquery=div.my_classMatches by jQuery/sizzle selectorsizzleClick Element | sizzle=div.my_classMatches by jQuery/sizzle selectortagClick Element | tag=divMatches by HTML tag namedefault*Click Link | default=page?a=bMatches key attributes with value after first '='

    * Explicitly specifying the default strategy is only necessary if locating elements by matching key attributes is desired and an attribute value contains a '='. The following would fail because it appears as ifpage?a is the specified lookup strategy:

    Click Link page?a=b

    This can be fixed by changing the locator to:

    Click Link default=page?a=b

    Using webelements


    Starting with version 1.7 of the Selenium2Library, one can pass an argument that contains a WebElement instead of a string locator. To get a WebElement, use the newGet WebElements keyword. For example:

    ${elem} =Get WebElementid=my_elementClick Element${elem} 

    Locating Tables, Table Rows, Columns, etc.


    Table related keywords, such as Table Should Contain, work differently. By default, when a table locator value is provided, it will search for a table with the specifiedid attribute. For example:

    Table Should Contain my_table text

    More complex table lookup strategies are also supported:

    StrategyExampleDescriptioncssTable Should Contain | css=table.my_class | textMatches by @id or @name attributexpathTable Should Contain | xpath=//table/[@name="my_table"]| textMatches by @id or @name attribute

    Custom Locators

    If more complex lookups are required than what is provided through the default locators, custom lookup strategies can be created. Using custom locators is a two part process. First, create a keyword that returns the WebElement that should be acted on.

    Custom Locator Strategy[Arguments]${browser}${criteria}${tag}${constraints} ${retVal}=Execute Javascriptreturn window.document.getElementById('${criteria}');   [Return]${retVal}   

    This keyword is a reimplementation of the basic functionality of the id locator where ${browser} is a reference to the WebDriver instance and${criteria} is the text of the locator (i.e. everything that comes after the = sign). To use this locator it must first be registered withAdd Location Strategy.

    Add Location Strategy custom Custom Locator Strategy

    The first argument of Add Location Strategy specifies the name of the lookup strategy (which must be unique). After registration of the lookup strategy, the usage is the same as other locators. SeeAdd Location Strategy for more details.

    Timeouts

    There are several Wait ... keywords that take timeout as an argument. All of these timeout arguments are optional. The timeout used by all of them can be set globally using theSet Selenium Timeout keyword. The same timeout also applies to Execute Async Javascript.

    All timeouts 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:http://robotframework.googlecode.com/svn/trunk/doc/userguide/RobotFrameworkUserGuide.html#time-format.

    Importing

    ArgumentsDocumentationtimeout=5.0, implicit_wait=0.0, run_on_failure=Capture Page Screenshot, screenshot_root_directory=None

    Selenium2Library can be imported with optional arguments.

    timeout is the default timeout used to wait for all waiting actions. It can be later set withSet Selenium Timeout.

    'implicit_wait' is the implicit timeout that Selenium waits when looking for elements. It can be later set withSet Selenium Implicit Wait. See WebDriver: Advanced Usage__ section of the SeleniumHQ documentation for more information about WebDriver's implicit wait functionality.

    __ http://seleniumhq.org/docs/04_webdriver_advanced.html#explicit-and-implicit-waits

    run_on_failure specifies the name of a keyword (from any available libraries) to execute when a Selenium2Library keyword fails. By defaultCapture Page Screenshot will be used to take a screenshot of the current page. Using the value "Nothing" will disable this feature altogether. SeeRegister Keyword To Run On Failure keyword for more information about this functionality.

    screenshot_root_directory specifies the default root directory that screenshots should be stored in. If not provided the default directory will be where robotframework places its logfile.

    Examples:

    Library | Selenium2Library | 15# Sets default timeout to 15 secondsLibrary | Selenium2Library | 0| 5# Sets default timeout to 0 seconds and default implicit_wait to 5 secondsLibrary | Selenium2Library | 5| run_on_failure=Log Source# Sets default timeout to 5 seconds and runs Log Source on failureLibrary | Selenium2Library | implicit_wait=5| run_on_failure=Log Source# Sets default implicit_wait to 5 seconds and runs Log Source on failureLibrary | Selenium2Library | timeout=10| run_on_failure=Nothing# Sets default timeout to 10 seconds and does nothing on failure

    Shortcuts

    Add Cookie · Add Location Strategy · Alert Should 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 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 Visible · Element Should Contain · Element Should Not Be Visible · Element Should Not Contain · Element Text Should Be · Execute Async Javascript · Execute Javascript · Focus · Frame Should Contain · Get Alert Message · Get All Links · Get Cookie Value · Get Cookies · Get Element Attribute · Get Element Size · Get Horizontal Position · Get List Items · Get Location · 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 Identifiers · Get Window Names · Get Window Position · Get Window Size · Get Window Titles · Go Back · Go To · Input Password · Input Text · 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 Screenshot Directory · Set Selenium Implicit Wait · Set Selenium Speed · Set Selenium Timeout · Set Window Position · Set Window Size · Simulate · 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 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

    Keywords

    KeywordArgumentsDocumentationAdd Cookiename, 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

    Add Location Strategystrategy_name, strategy_keyword, persist=False

    Adds a custom location strategy based on a user keyword. Location strategies are automatically removed after leaving the current scope by default. Settingpersist to any non-empty string will cause the location strategy to stay registered throughout the life of the test.

    Trying to add a custom location strategy with the same name as one that already exists will cause the keyword to fail.

    Custom locator keyword example:

    Custom Locator Strategy[Arguments]${browser}${criteria}${tag}${constraints} ${retVal}=Execute Javascriptreturn window.document.getElementById('${criteria}');   [Return]${retVal}   

    Usage example:

    Add Location StrategycustomCustom Locator StrategyPage Should Contain Elementcustom=my_id 

    See Remove Location Strategy for details about removing a custom location strategy.

    Alert Should Be Presenttext=

    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 totext.

    Will fail if no alert is present. Note that following keywords will fail unless the alert is dismissed by this keyword or another likeGet Alert Message.

    Assign Id To Elementlocator, 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.

    Example:

    Assign ID to Elementxpath=//div[@id="first_div"]my idPage Should Contain Elementmy id  Capture Page Screenshotfilename=selenium-screenshot-{index}.png

    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 nofilename is given, the screenshot is saved into file selenium-screenshot-{index}.png under the directory where the Robot Framework log file is written into. Thefilename is also considered relative to the same directory, if it is not given in absolute format. If an absolute or relative path is given but the path does not exist it will be created.

    Starting from Selenium2Library 1.8 if filename contains {index} characters, it will be automatically replaced with running index. The running index is unique for each different filename. The absolute path of the saved screenshot is always returned and it does not depend does the filename contain {index}. See example 1 and 2 for more details.

    The {index} is replaced with the actual index by using Python's str.format method, and it can be formatted using the standard format string syntax. The example 3 shows this by setting the width and the fill character.

    If there is a need to write literal {index} or if filename contains{ or } characters, then the braces must be doubled.

    Example 1:

    ${file1} =Capture Page Screenshot File Should Exist${OUTPUTDIR}${/}selenium-screenshot-1.png Should Be Equal${file1}${OUTPUTDIR}${/}selenium-screenshot-1.png${file2} =Capture Page Screenshot File Should Exist${OUTPUTDIR}${/}selenium-screenshot-2.png Should Be Equal${file2}${OUTPUTDIR}${/}selenium-screenshot-2.png

    Example 2:

    ${file1} =Capture Page Screenshot${OTHER_DIR}${/}other-{index}-name.png${file2} =Capture Page Screenshot${OTHER_DIR}${/}some-other-name-{index}.png${file3} =Capture Page Screenshot${OTHER_DIR}${/}other-{index}-name.pngFile Should Exist${OTHER_DIR}${/}other-1-name.png Should Be Equal${file1}${OTHER_DIR}${/}other-1-name.pngFile Should Exist${OTHER_DIR}${/}some-other-name-1.png Should Be Equal${file2}${OTHER_DIR}${/}some-other-name-1.pngFile Should Exist${OTHER_DIR}${/}other-2-name.png Should Be Equal${file3}${OTHER_DIR}${/}other-2-name.png

    Example 3:

    Capture Page Screenshot${OTHER_DIR}${/}sc-{index:06}.pngFile Should Exist${OTHER_DIR}${/}sc-000001.png Checkbox Should Be Selectedlocator

    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 Not Be Selectedlocator

    Verifies checkbox identified by locator is not selected/checked.

    Key attributes for checkboxes are id and name. See introduction for details about locating elements.

    Choose Cancel On Next Confirmation 

    Cancel will be selected the next time Confirm Action is used.

    Choose Filelocator, file_path

    Inputs the file_path into file input field found by locator.

    This keyword is most often used to input files into upload forms. The file specified withfile_path must be available on the same host where the Selenium Server is running.

    Example:

    Choose Filemy_upload_field/home/user/files/trades.csv Choose Ok On Next Confirmation 

    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 useChoose Cancel On Next Confirmation for each confirmation.

    Note that every time a confirmation comes up, you must consume it by using a keywords such asGet Alert Message, or else the following selenium operations will fail.

    Clear Element Textlocator

    Clears the text value of text entry element identified by locator.

    See introduction for details about locating elements.

    Click Buttonlocator

    Clicks a button identified by locator.

    Key attributes for buttons are id, name and value. See introduction for details about locating elements.

    Click Elementlocator

    Click element identified by locator.

    Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

    Click Element At Coordinateslocator, 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.

    Click Imagelocator

    Clicks an image found by locator.

    Key attributes for images are id, src and alt. See introduction for details about locating elements.

    Click Linklocator

    Clicks a link identified by locator.

    Key attributes for links are id, name, href and link text. See introduction for details about locating elements.

    Close All Browsers 

    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.

    Close Browser 

    Closes the current browser.

    Close Window 

    Closes currently opened pop-up window.

    Confirm Action 

    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, keywordChoose Cancel On Next Confirmation must be called before the action that causes the confirmation dialog to be shown.

    Examples:

    Click ButtonSend# Shows a confirmation dialog${message}=Confirm Action# Chooses OkShould Be Equal${message}Are your sure?   Choose Cancel On Next Confirmation  Click ButtonSend# Shows a confirmation dialogConfirm Action # Chooses Cancel Create Webdriverdriver_name, alias=None, kwargs={}, **init_kwargs

    Creates an instance of a WebDriver.

    Like Open Browser, but allows passing arguments to a WebDriver's __init__. Open Browser is preferred overCreate Webdriver when feasible.

    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 whenClose All Browsers keyword is used. See Switch Browser for example.

    driver_name must be the exact name of a WebDriver inselenium.webdriver to use. WebDriver names include: Firefox, Chrome, Ie, Opera, Safari, PhantomJS, and Remote.

    Use keyword arguments to specify the arguments you want to pass to the WebDriver's __init__. The values of the arguments are not processed in any way before being passed on. For Robot Framework < 2.8, which does not support keyword arguments, create a keyword dictionary and pass it in as argument kwargs. See the Selenium API Documentation for information about argument names and appropriate argument values.

    Examples:

    # use proxy for Firefox   ${proxy}=Evaluatesys.modules['selenium.webdriver'].Proxy()sys, selenium.webdriver${proxy.http_proxy}=Set Variablelocalhost:8888 Create WebdriverFirefoxproxy=${proxy} # use a proxy for PhantomJS   ${service args}=Create List--proxy=192.168.132.104:8888 Create WebdriverPhantomJSservice_args=${service args} 

    Example for Robot Framework < 2.8:

    # debug IE driver   ${kwargs}=Create Dictionarylog_level=DEBUGlog_file=%{HOMEPATH}${/}ie.logCreate WebdriverIekwargs=${kwargs}  Current Frame Containstext, loglevel=INFO

    Verifies that current frame contains text.

    See Page Should Contain for explanation about loglevel argument.

    Current Frame Should Not Containtext, loglevel=INFO

    Verifies that current frame contains text.

    See Page Should Contain for explanation about loglevel argument.

    Delete All Cookies 

    Deletes all cookies.

    Delete Cookiename

    Deletes cookie matching name.

    If the cookie is not found, nothing happens.

    Dismiss Alertaccept=True

    Returns true if alert was confirmed, false if it was dismissed

    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 likeGet Alert Message.

    Double Click Elementlocator

    Double click element identified by locator.

    Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

    Drag And Dropsource, 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.

    Examples:

    Drag And Dropelem1elem2# Move elem1 over elem2. Drag And Drop By Offsetsource, 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.

    Examples:

    Drag And Drop By OffsetmyElem50-35# Move myElem 50px right and 35px down. Element Should Be Disabledlocator

    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 Enabledlocator

    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 Visiblelocator, 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 Containlocator, expected, message=

    Verifies element identified by locator contains textexpected.

    If you wish to assert an exact (not a substring) match on the text of the element, useElement 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 Not Be Visiblelocator, 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 Containlocator, expected, message=

    Verifies element identified by locator does not contain textexpected.

    message can be used to override the default error message.

    Key attributes for arbitrary elements are id and name. See Element Should Contain for more details.

    Element Text Should Belocator, expected, message=

    Verifies element identified by locator exactly contains textexpected.

    In contrast to Element Should Contain, this keyword does not try a substring match but an exact match on the element identified bylocator.

    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.

    Execute Async Javascript*code

    Executes asynchronous JavaScript code.

    Similar to Execute Javascript except that scripts executed with this keyword must explicitly signal they are finished by invoking the provided callback. This callback is always injected into the executed function as the last argument.

    Scripts must complete within the script timeout or this keyword will fail. See theTimeouts section for more information.

    Examples:

    Execute Async JavaScriptvar callback = arguments[arguments.length - 1];window.setTimeout(callback, 2000);Execute Async JavaScript${CURDIR}/async_js_to_execute.js ${retval}=Execute Async JavaScript ...var callback = arguments[arguments.length - 1]; ...function answer(){callback("text");}; ...window.setTimeout(answer, 2000); Should Be Equal${retval}text Execute Javascript*code

    Executes the given JavaScript code.

    code may contain multiple lines of code and 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.

    The JavaScript executes in the context of the currently selected frame or window as the body of an anonymous function. Usewindow to refer to the window of your application and document to refer to the document object of the current frame or window, e.g.document.getElementById('foo').

    This keyword returns None unless there is a return statement in the JavaScript. Return values are converted to the appropriate type in Python, including WebElements.

    Examples:

    Execute JavaScriptwindow.my_js_function('arg1', 'arg2') Execute JavaScript${CURDIR}/js_to_execute.js ${sum}=Execute JavaScriptreturn 1 + 1;Should Be Equal${sum}${2} Focuslocator

    Sets focus to element identified by locator.

    Frame Should Containlocator, 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.

    Get Alert Messagedismiss=True

    Returns the text of current JavaScript alert.

    By default the current JavaScript alert will be dismissed. 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 likeGet Alert Message.

    Get All Links 

    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.

    Get Cookie Valuename

    Returns value of cookie found with name.

    If no cookie is found with name, this keyword fails.

    Get Cookies 

    Returns all cookies of the current page.

    Get Element Attributeattribute_locator

    Return value of element attribute.

    attribute_locator consists of element locator followed by an @ sign and attribute name, for example "element_id@class".

    Get Element Sizelocator

    Returns width and height of element identified by locator.

    The element width and height is returned. Fails if a matching element is not found.

    Get Horizontal Positionlocator

    Returns horizontal position of element identified by locator.

    The position is returned in pixels off the left side of the page, as an integer. Fails if a matching element is not found.

    See also Get Vertical Position.

    Get List Itemslocator

    Returns the values in the select list identified by locator.

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Get Location 

    Returns the current location.

    Get Matching Xpath Countxpath

    Returns number of elements matching xpath

    One should not use the xpath= prefix for 'xpath'. XPath is assumed.

    Correct:

    count = | Get Matching Xpath Count | //div[@id='sales-pop']

    Incorrect:

    count = | Get Matching Xpath Count | xpath=//div[@id='sales-pop']

    If you wish to assert the number of matching elements, use Xpath Should Match X Times.

    Get Selected List Labellocator

    Returns the visible label of the selected element from the select list identified bylocator.

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Get Selected List Labelslocator

    Returns the visible labels of selected elements (as a list) from the select list identified bylocator.

    Fails if there is no selection.

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Get Selected List Valuelocator

    Returns the value of the selected element from the select list identified by locator.

    Return value is read from value attribute of the selected element.

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Get Selected List Valueslocator

    Returns the values of selected elements (as a list) from the select list identified bylocator.

    Fails if there is no selection.

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Get Selenium Implicit Wait 

    Gets the wait in seconds that is waited by Selenium.

    See Set Selenium Implicit Wait for an explanation.

    Get Selenium Speed 

    Gets the delay in seconds that is waited after each Selenium command.

    See Set Selenium Speed for an explanation.

    Get Selenium Timeout 

    Gets the timeout in seconds that is used by various keywords.

    See Set Selenium Timeout for an explanation.

    Get Source 

    Returns the entire html source of the current page or frame.

    Get Table Celltable_locator, row, column, loglevel=INFO

    Returns the content from a table cell.

    Row and column number start from 1. Header and footer rows are included in the count. A negative row or column number can be used to get rows counting from the end (end: -1). Cell content from header or footer rows can be obtained with this keyword. To understand how tables are identified, please take a look at the introduction.

    See Page Should Contain for explanation about loglevel argument.

    Get Textlocator

    Returns the text value of element identified by locator.

    See introduction for details about locating elements.

    Get Title 

    Returns title of current page.

    Get Valuelocator

    Returns the value attribute of element identified by locator.

    See introduction for details about locating elements.

    Get Vertical Positionlocator

    Returns vertical position of element identified by locator.

    The position is returned in pixels off the top of the page, as an integer. Fails if a matching element is not found.

    See also Get Horizontal Position.

    Get Webelementlocator

    Returns the first WebElement matching the given locator.

    See introduction for details about locating elements.

    Get Webelementslocator

    Returns list of WebElement objects matching locator.

    See introduction for details about locating elements.

    Get Window Identifiers 

    Returns and logs id attributes of all windows known to the browser.

    Get Window Names 

    Returns and logs names of all windows known to the browser.

    Get Window Position 

    Returns current window position as x then y.

    Example:

    ${x}${y}=Get Window Position Get Window Size 

    Returns current window size as width then height.

    Example:

    ${width}${height}=Get Window Size Get Window Titles 

    Returns and logs titles of all windows known to the browser.

    Go Back 

    Simulates the user clicking the "back" button on their browser.

    Go Tourl

    Navigates the active browser instance to the provided URL.

    Input Passwordlocator, text

    Types the given password into text field identified by locator.

    Difference between this keyword and Input Text is that this keyword does not log the given password. See introduction for details about locating elements.

    Input Textlocator, text

    Types the given text into text field identified by locator.

    See introduction for details about locating elements.

    Input Text Into Prompttext

    Types the given text into alert box.

    List Selection Should Belocator, *items

    Verifies the selection of select list identified by locator is exactly*items.

    If you want to test that no option is selected, simply give no items.

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    List Should Have No Selectionslocator

    Verifies select list identified by locator has no selections.

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    List Windows 

    Return all current window handles as a list

    Location Should Beurl

    Verifies that current URL is exactly url.

    Location Should Containexpected

    Verifies that current URL contains expected.

    Locator Should Match X Timeslocator, expected_locator_count, message=, loglevel=INFO

    Verifies that the page contains the given number of elements located by the givenlocator.

    See introduction for details about locating elements.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Log Location 

    Logs and returns the current location.

    Log Sourceloglevel=INFO

    Logs and returns the entire html source of the current page or frame.

    The loglevel argument defines the used log level. Valid log levels are WARN, INFO (default), DEBUG, and NONE (no logging).

    Log Title 

    Logs and returns the title of current page.

    Maximize Browser Window 

    Maximizes current browser window.

    Mouse Downlocator

    Simulates pressing the left mouse button on the element specified by locator.

    The element is pressed without releasing the mouse button.

    Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

    See also the more specific keywords Mouse Down On Image and Mouse Down On Link.

    Mouse Down On Imagelocator

    Simulates a mouse down event on an image.

    Key attributes for images are id, src and alt. See introduction for details about locating elements.

    Mouse Down On Linklocator

    Simulates a mouse down event on a link.

    Key attributes for links are id, name, href and link text. See introduction for details about locating elements.

    Mouse Outlocator

    Simulates moving mouse away from the element specified by locator.

    Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

    Mouse Overlocator

    Simulates hovering mouse over the element specified by locator.

    Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

    Mouse Uplocator

    Simulates releasing the left mouse button on the element specified by locator.

    Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

    Open Browserurl, browser=firefox, alias=None, remote_url=False, desired_capabilities=None, ff_profile_dir=None

    Opens a new browser instance to given URL.

    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 whenClose All Browsers keyword is used. See Switch Browser for example.

    Optional alias is an alias for the browser instance and it can be used for switching between browsers (just as index can be used). SeeSwitch Browser for more details.

    Possible values for browser are as follows:

    firefoxFireFoxffFireFoxinternetexplorerInternet ExplorerieInternet ExplorergooglechromeGoogle ChromegcGoogle ChromechromeGoogle ChromeoperaOperaphantomjsPhantomJShtmlunitHTMLUnithtmlunitwithjsHTMLUnit with Javascipt supportandroidAndroidiphoneIphonesafariSafariedgeEdge

    Note, that you will encounter strange behavior, if you open multiple Internet Explorer browser instances. That is also whySwitch Browser only works with one IE browser at most. For more information see:http://selenium-grid.seleniumhq.org/faq.html#i_get_some_strange_errors_when_i_run_multiple_internet_explorer_instances_on_the_same_machine

    Optional 'remote_url' is the url for a remote selenium server for example http://127.0.0.1:4444/wd/hub. If you specify a value for remote you can also specify 'desired_capabilities' which is a string in the form key1:val1,key2:val2 that will be used to specify desired_capabilities to the remote server. This is useful for doing things like specify a proxy server for internet explorer or for specify browser and os if your using saucelabs.com. 'desired_capabilities' can also be a dictonary (created with 'Create Dictionary') to allow for more complex configurations.

    Optional 'ff_profile_dir' is the path to the firefox profile dir if you wish to overwrite the default.

    Open Context Menulocator

    Opens context menu on element identified by locator.

    Page Should Containtext, loglevel=INFO

    Verifies that current page contains text.

    If this keyword fails, it automatically logs the page source using the log level specified with the optionalloglevel argument. Valid log levels are DEBUG, INFO (default), WARN, and NONE. If the log level is NONE or below the current active log level the source will not be logged.

    Page Should Contain Buttonlocator, message=, loglevel=INFO

    Verifies button identified by locator is found from current page.

    This keyword searches for buttons created with either input orbutton tag.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for buttons are id, name and value. See introduction for details about locating elements.

    Page Should Contain Checkboxlocator, message=, loglevel=INFO

    Verifies checkbox identified by locator is found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for checkboxes are id and name. See introduction for details about locating elements.

    Page Should Contain Elementlocator, message=, loglevel=INFO

    Verifies element identified by locator is found on the current page.

    message can be used to override default error message.

    See Page Should Contain for explanation about loglevel argument.

    Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

    Page Should Contain Imagelocator, message=, loglevel=INFO

    Verifies image identified by locator is found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for images are id, src and alt. See introduction for details about locating elements.

    Page Should Contain Linklocator, message=, loglevel=INFO

    Verifies link identified by locator is found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for links are id, name, href and link text. See introduction for details about locating elements.

    Page Should Contain Listlocator, message=, loglevel=INFO

    Verifies select list identified by locator is found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for lists are id and name. See introduction for details about locating elements.

    Page Should Contain Radio Buttonlocator, message=, loglevel=INFO

    Verifies radio button identified by locator is found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for radio buttons are id, name and value. See introduction for details about locating elements.

    Page Should Contain Textfieldlocator, message=, loglevel=INFO

    Verifies text field identified by locator is found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for text fields are id and name. See introduction for details about locating elements.

    Page Should Not Containtext, loglevel=INFO

    Verifies the current page does not contain text.

    See Page Should Contain for explanation about loglevel argument.

    Page Should Not Contain Buttonlocator, message=, loglevel=INFO

    Verifies button identified by locator is not found from current page.

    This keyword searches for buttons created with either input orbutton tag.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for buttons are id, name and value. See introduction for details about locating elements.

    Page Should Not Contain Checkboxlocator, message=, loglevel=INFO

    Verifies checkbox identified by locator is not found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for checkboxes are id and name. See introduction for details about locating elements.

    Page Should Not Contain Elementlocator, message=, loglevel=INFO

    Verifies element identified by locator is not found on the current page.

    message can be used to override the default error message.

    See Page Should Contain for explanation about loglevel argument.

    Key attributes for arbitrary elements are id and name. See introduction for details about locating elements.

    Page Should Not Contain Imagelocator, message=, loglevel=INFO

    Verifies image identified by locator is found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for images are id, src and alt. See introduction for details about locating elements.

    Page Should Not Contain Linklocator, message=, loglevel=INFO

    Verifies image identified by locator is not found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for images are id, src and alt. See introduction for details about locating elements.

    Page Should Not Contain Listlocator, message=, loglevel=INFO

    Verifies select list identified by locator is not found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for lists are id and name. See introduction for details about locating elements.

    Page Should Not Contain Radio Buttonlocator, message=, loglevel=INFO

    Verifies radio button identified by locator is not found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for radio buttons are id, name and value. See introduction for details about locating elements.

    Page Should Not Contain Textfieldlocator, message=, loglevel=INFO

    Verifies text field identified by locator is not found from current page.

    See Page Should Contain Element for explanation about message andloglevel arguments.

    Key attributes for text fields are id and name. See introduction for details about locating elements.

    Press Keylocator, key

    Simulates user pressing key on element identified by locator.key is either a single character, a string, or a numerical ASCII code of the key lead by '\\'. Examples:

    Press Keytext_fieldq Press Keytext_fieldabcde Press Keylogin_button\\13# ASCII code for enter key Radio Button Should Be Set Togroup_name, value

    Verifies radio button group identified by group_name has its selection set tovalue.

    See Select Radio Button for information about how radio buttons are located.

    Radio Button Should Not Be Selectedgroup_name

    Verifies radio button group identified by group_name has no selection.

    See Select Radio Button for information about how radio buttons are located.

    Register Keyword To Run On Failurekeyword

    Sets the keyword to execute when a Selenium2Library keyword fails.

    keyword_name is the name of a keyword (from any available libraries) that will be executed if a Selenium2Library keyword fails. It is not possible to use a keyword that requires arguments. Using the value "Nothing" will disable this feature altogether.

    The initial keyword to use is set in importing, 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.

    This keyword returns the name of the previously registered failure keyword. It can be used to restore the original value later.

    Example:

    Register Keyword To Run On FailureLog Source# Run Log Source on failure. ${previous kw}=Register Keyword To Run On FailureNothing# Disables run-on-failure functionality and stores the previous kw name in a variable.Register Keyword To Run On Failure${previous kw}# Restore to the previous keyword. 

    This run-on-failure functionality only works when running tests on Python/Jython 2.4 or newer and it does not work on IronPython at all.

    Reload Page 

    Simulates user reloading page.

    Remove Location Strategystrategy_name

    Removes a previously added custom location strategy. Will fail if a default strategy is specified.

    See Add Location Strategy for details about adding a custom location strategy.

    Select All From Listlocator

    Selects all values from multi-select list identified by id.

    Key attributes for lists are id and name. See introduction for details about locating elements.

    Select Checkboxlocator

    Selects checkbox identified by locator.

    Does nothing if checkbox is already selected. Key attributes for checkboxes areid and name. See introduction for details about locating elements.

    Select Framelocator

    Sets frame identified by locator as current frame.

    Key attributes for frames are id and name. See introduction for details about locating elements.

    Select From Listlocator, *items

    Selects *items from list identified by locator

    If more than one value is given for a single-selection list, the last value will be selected. If the target list is a multi-selection list, and*items is an empty list, all values of the list will be selected.

    *items try to select by value then by label.

    It's faster to use 'by index/value/label' functions.

    An exception is raised for a single-selection list if the last value does not exist in the list and a warning for all other non- existing items. For a multi-selection list, an exception is raised for any and all non-existing values.

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Select From List By Indexlocator, *indexes

    Selects *indexes from list identified by locator

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Select From List By Labellocator, *labels

    Selects *labels from list identified by locator

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Select From List By Valuelocator, *values

    Selects *values from list identified by locator

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Select Radio Buttongroup_name, value

    Sets selection of radio button group identified by group_name tovalue.

    The radio button to be selected is located by two arguments:

    group_name is used as the name of the radio inputvalue is used for the value attribute or for the id attribute

    The XPath used to locate the correct radio button then looks like this: //input[@type='radio' and @name='group_name' and (@value='value' or @id='value')]

    Examples:

    Select Radio ButtonsizeXL# Matches HTML like <input type="radio" name="size" value="XL">XL</input>Select Radio ButtonsizesizeXL# Matches HTML like <input type="radio" name="size" value="XL" id="sizeXL">XL</input> Select Windowlocator=None

    Selects the window matching locator and return previous window handle.

    locator: any of name, title, url, window handle, excluded handle's list, or special words. return: either current window handle before selecting, or None if no current window.

    If the window is found, all subsequent commands use that window, until this keyword is used again. If the window is not found, this keyword fails.

    By default, when a locator value is provided, it is matched against the title of the window and the javascript name of the window. If multiple windows with same identifier are found, the first one is selected.

    There are some special locators for searching target window: string 'main' (default): select the main window; string 'self': only return current window handle; string 'new': select the last-indexed window assuming it is the newest opened window window list: select the first window not in given list (See 'List Windows' to get the list)

    It is also possible to specify the approach Selenium2Library should take to find a window by specifying a locator strategy:

    StrategyExampleDescriptiontitleSelect Window | title=My DocumentMatches by window titlenameSelect Window | name=${name}Matches by window javascript nameurlSelect Window | url=http://google.comMatches by window's current URL

    Example:

    Click Linkpopup_link# opens new window Select WindowpopupName  Title Should BePopup Title  Select Window  # Chooses the main window again Set Browser Implicit Waitseconds

    Sets current browser's implicit wait in seconds.

    From selenium 2 function 'Sets a sticky timeout to implicitly wait for an element to be found, or a command to complete. This method only needs to be called one time per session.'

    Example:

    Set Browser Implicit Wait10 seconds

    See also Set Selenium Implicit Wait.

    Set Screenshot Directorypath, persist=False

    Sets the root output directory for captured screenshots.

    path argument specifies the absolute path where the screenshots should be written to. If the specifiedpath does not exist, it will be created. Setting persist specifies that the givenpath should be used for the rest of the test execution, otherwise the path will be restored at the end of the currently executing scope.

    Set Selenium Implicit Waitseconds

    Sets Selenium 2's default implicit wait in seconds and sets the implicit wait for all open browsers.

    From selenium 2 function 'Sets a sticky timeout to implicitly wait for an element to be found, or a command to complete. This method only needs to be called one time per session.'

    Example:

    ${orig wait} =Set Selenium Implicit Wait10 secondsPerform AJAX call that is slow  Set Selenium Implicit Wait${orig wait}  Set Selenium Speedseconds

    Sets the delay in seconds that is waited after each Selenium command.

    This is useful mainly in slowing down the test execution to be able to view the execution.seconds may be given in Robot Framework time format. Returns the previous speed value.

    Example:

    Set Selenium Speed.5 seconds Set Selenium Timeoutseconds

    Sets the timeout in seconds used by various keywords.

    There are several Wait ... keywords that take timeout as an argument. All of these timeout arguments are optional. The timeout used by all of them can be set globally using this keyword. SeeTimeouts for more information about timeouts.

    The previous timeout value is returned by this keyword and can be used to set the old value back later. The default timeout is 5 seconds, but it can be altered inimporting.

    Example:

    ${orig timeout} =Set Selenium Timeout15 secondsOpen page that loads slowly  Set Selenium Timeout${orig timeout}  Set Window Positionx, y

    Sets the position x and y of the current window to the specified values.

    Example:

    Set Window Size${1000}${0}${x}${y}=Get Window PositionShould Be Equal${x}${1000}Should Be Equal${y}${0} Set Window Sizewidth, height

    Sets the width and height of the current window to the specified values.

    Example:

    Set Window Size${800}${600}${width}${height}=Get Window SizeShould Be Equal${width}${800}Should Be Equal${height}${600} Simulatelocator, event

    Simulates event on element identified by locator.

    This keyword is useful if element has OnEvent handler that needs to be explicitly invoked.

    See introduction for details about locating elements.

    Submit Formlocator=None

    Submits a form identified by locator.

    If locator is empty, first form in the page will be submitted. Key attributes for forms areid and name. See introduction for details about locating elements.

    Switch Browserindex_or_alias

    Switches between active browsers using index or alias.

    Index is returned from Open Browser and alias can be given to it.

    Example:

    Open Browserhttp://google.comff Location Should Behttp://google.com  Open Browserhttp://yahoo.comie2nd connLocation Should Behttp://yahoo.com  Switch Browser1# index Page Should ContainI'm feeling lucky  Switch Browser2nd conn# alias Page Should ContainMore Yahoo!  Close All Browsers   

    Above example expects that there was no other open browsers when opening the first one because it used index '1' when switching to it later. If you aren't sure about that you can store the index into a variable as below.

    ${id} =Open Browserhttp://google.com*firefox# Do something ...   Switch Browser${id}   Table Cell Should Containtable_locator, row, column, expected, loglevel=INFO

    Verifies that a certain cell in a table contains expected.

    Row and column number start from 1. This keyword passes if the specified cell contains the given content. If you want to test that the cell content matches exactly, or that it e.g. starts with some text, useGet Table Cell keyword in combination with built-in keywords such as Should Be Equal or Should Start With.

    To understand how tables are identified, please take a look at the introduction.

    See Page Should Contain for explanation about loglevel argument.

    Table Column Should Containtable_locator, col, expected, loglevel=INFO

    Verifies that a specific column contains expected.

    The first leftmost column is column number 1. A negative column number can be used to get column counting from the end of the row (end: -1). If the table contains cells that span multiple columns, those merged cells count as a single column. For example both tests below work, if in one row columns A and B are merged with colspan="2", and the logical third column contains "C".

    Example:

    Table Column Should ContaintableId3CTable Column Should ContaintableId2C

    To understand how tables are identified, please take a look at the introduction.

    See Page Should Contain Element for explanation about loglevel argument.

    Table Footer Should Containtable_locator, expected, loglevel=INFO

    Verifies that the table footer contains expected.

    With table footer can be described as any <td>-element that is child of a <tfoot>-element. To understand how tables are identified, please take a look at theintroduction.

    See Page Should Contain Element for explanation about loglevel argument.

    Table Header Should Containtable_locator, expected, loglevel=INFO

    Verifies that the table header, i.e. any <th>...</th> element, contains expected.

    To understand how tables are identified, please take a look at the introduction.

    See Page Should Contain Element for explanation about loglevel argument.

    Table Row Should Containtable_locator, row, expected, loglevel=INFO

    Verifies that a specific table row contains expected.

    The uppermost row is row number 1. A negative column number can be used to get column counting from the end of the row (end: -1). For tables that are structured with thead, tbody and tfoot, only the tbody section is searched. Please useTable Header Should Contain or Table Footer Should Contain for tests against the header or footer content.

    If the table contains cells that span multiple rows, a match only occurs for the uppermost row of those merged cells. To understand how tables are identified, please take a look at theintroduction.

    See Page Should Contain Element for explanation about loglevel argument.

    Table Should Containtable_locator, expected, loglevel=INFO

    Verifies that expected can be found somewhere in the table.

    To understand how tables are identified, please take a look at the introduction.

    See Page Should Contain Element for explanation about loglevel argument.

    Textarea Should Containlocator, expected, message=

    Verifies text area identified by locator contains textexpected.

    message can be used to override default error message.

    Key attributes for text areas are id and name. See introduction for details about locating elements.

    Textarea Value Should Belocator, expected, message=

    Verifies the value in text area identified by locator is exactlyexpected.

    message can be used to override default error message.

    Key attributes for text areas are id and name. See introduction for details about locating elements.

    Textfield Should Containlocator, expected, message=

    Verifies text field identified by locator contains textexpected.

    message can be used to override default error message.

    Key attributes for text fields are id and name. See introduction for details about locating elements.

    Textfield Value Should Belocator, expected, message=

    Verifies the value in text field identified by locator is exactlyexpected.

    message can be used to override default error message.

    Key attributes for text fields are id and name. See introduction for details about locating elements.

    Title Should Betitle

    Verifies that current page title equals title.

    Unselect Checkboxlocator

    Removes selection of checkbox identified by locator.

    Does nothing if the checkbox is not checked. Key attributes for checkboxes areid and name. See introduction for details about locating elements.

    Unselect Frame 

    Sets the top frame as the current frame.

    Unselect From Listlocator, *items

    Unselects given values from select list identified by locator.

    As a special case, giving empty list as *items will remove all selections.

    *items try to unselect by value AND by label.

    It's faster to use 'by index/value/label' functions.

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Unselect From List By Indexlocator, *indexes

    Unselects *indexes from list identified by locator

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Unselect From List By Labellocator, *labels

    Unselects *labels from list identified by locator

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Unselect From List By Valuelocator, *values

    Unselects *values from list identified by locator

    Select list keywords work on both lists and combo boxes. Key attributes for select lists areid and name. See introduction for details about locating elements.

    Wait For Conditioncondition, timeout=None, error=None

    Waits until the given condition is true or timeout expires.

    The condition can be arbitrary JavaScript expression but must contain a return statement (with the value to be returned) at the end. SeeExecute JavaScript for information about accessing the actual contents of the window through JavaScript.

    error can be used to override the default error message.

    See introduction for more information about timeout and its default value.

    See also Wait Until Page Contains, Wait Until Page Contains Element, Wait Until Element Is Visible and BuiltIn keyword Wait Until Keyword Succeeds.

    Wait Until Element Containslocator, text, timeout=None, error=None

    Waits until given element contains text.

    Fails if timeout expires before the text appears on given element. Seeintroduction for more information about timeout and its default value.

    error can be used to override the default error message.

    See also Wait Until Page Contains, Wait Until Page Contains Element, Wait For Condition, Wait Until Element Is Visible and BuiltIn keyword Wait Until Keyword Succeeds.

    Wait Until Element Does Not Containlocator, text, timeout=None, error=None

    Waits until given element does not contain text.

    Fails if timeout expires before the text disappears from given element. Seeintroduction for more information about timeout and its default value.

    error can be used to override the default error message.

    See also Wait Until Page Contains, Wait Until Page Contains Element, Wait For Condition, Wait Until Element Is Visible and BuiltIn keyword Wait Until Keyword Succeeds.

    Wait Until Element Is Enabledlocator, timeout=None, error=None

    Waits until element specified with locator is enabled.

    Fails if timeout expires before the element is enabled. Seeintroduction for more information about timeout and its default value.

    error can be used to override the default error message.

    See also Wait Until Page Contains, Wait Until Page Contains Element, Wait For Condition and BuiltIn keyword Wait Until Keyword Succeeds.

    Wait Until Element Is Not Visiblelocator, timeout=None, error=None

    Waits until element specified with locator is not visible.

    Fails if timeout expires before the element is not visible. Seeintroduction for more information about timeout and its default value.

    error can be used to override the default error message.

    See also Wait Until Page Contains, Wait Until Page Contains Element, Wait For Condition and BuiltIn keyword Wait Until Keyword Succeeds.

    Wait Until Element Is Visiblelocator, timeout=None, error=None

    Waits until element specified with locator is visible.

    Fails if timeout expires before the element is visible. Seeintroduction for more information about timeout and its default value.

    error can be used to override the default error message.

    See also Wait Until Page Contains, Wait Until Page Contains Element, Wait For Condition and BuiltIn keyword Wait Until Keyword Succeeds.

    Wait Until Page Containstext, timeout=None, error=None

    Waits until text appears on current page.

    Fails if timeout expires before the text appears. Seeintroduction for more information about timeout and its default value.

    error can be used to override the default error message.

    See also Wait Until Page Contains Element, Wait For Condition, Wait Until Element Is Visible and BuiltIn keyword Wait Until Keyword Succeeds.

    Wait Until Page Contains Elementlocator, timeout=None, error=None

    Waits until element specified with locator appears on current page.

    Fails if timeout expires before the element appears. Seeintroduction for more information about timeout and its default value.

    error can be used to override the default error message.

    See also Wait Until Page Contains, Wait For Condition, Wait Until Element Is Visible and BuiltIn keyword Wait Until Keyword Succeeds.

    Wait Until Page Does Not Containtext, timeout=None, error=None

    Waits until text disappears from current page.

    Fails if timeout expires before the text disappears. See introduction for more information about timeout and its default value.

    error can be used to override the default error message.

    See also Wait Until Page Contains, Wait For Condition, Wait Until Element Is Visible and BuiltIn keyword Wait Until Keyword Succeeds.

    Wait Until Page Does Not Contain Elementlocator, timeout=None, error=None

    Waits until element specified with locator disappears from current page.

    Fails if timeout expires before the element disappears. Seeintroduction for more information about timeout and its default value.

    error can be used to override the default error message.

    See also Wait Until Page Contains, Wait For Condition, Wait Until Element Is Visible and BuiltIn keyword Wait Until Keyword Succeeds.

    Xpath Should Match X Timesxpath, expected_xpath_count, message=, loglevel=INFO

    Verifies that the page contains the given number of elements located by the givenxpath.

    One should not use the xpath= prefix for 'xpath'. XPath is assumed.

    Correct:

    Xpath Should Match X Times | //div[@id='sales-pop'] | 1

    Incorrect:

    Xpath Should Match X Times | xpath=//div[@id='sales-pop'] | 1

    See Page Should Contain Element for explanation about message andloglevel arguments.

    转载请注明原文地址: https://ju.6miu.com/read-962807.html

    最新回复(0)