Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/Selenium2Library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class Selenium2Library(
imported into your Robot test suite (see `importing` 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 ---**

*--- 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
Expand All @@ -42,14 +43,14 @@ class Selenium2Library(
specifying different location strategies. `webelement` is a variable that
holds a WebElement instance, which is a representation of the element.

Using 'locator'
*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 the `id` as a `locator`. For example::
using just the `id` as a `locator`. For example:

Click Element my_element
| 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
Expand All @@ -76,22 +77,22 @@ class Selenium2Library(
This can be fixed by changing the locator to:
| Click Link default=page?a=b

Using 'webelement'
*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 new `Get WebElements` keyword. For example:

| ${elem} = | Get WebElements | id=my_element |
| Click Element | ${elem} | |
| ${elem} = | Get WebElement | id=my_element |
| Click 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 specified `id` attribute. For example:

Table Should Contain my_table text
| Table Should Contain my_table text

More complex table lookup strategies are also supported:

Expand All @@ -113,7 +114,7 @@ class Selenium2Library(
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 with `Add Location Strategy`.

Add Location Strategy custom Custom Locator 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. See `Add Location Strategy` for more details.
Expand Down