Skip to content

Commit

Permalink
Browser management doc and message update (#952)
Browse files Browse the repository at this point in the history
* Clean up window tests.

Also add explicit tests for using "Set Window Position/Size" with
strings. Selenium seems to already convert values passed to it to
integers, decided to add conversion also to these keywords so that we
don't depent on that behavior.


- Move default locator strategy docs to beginning of the whole locator
  strategy section. This is the most common approach.
- Move note about old limitation with tables to a new place.

Documentation cleanup is related to #925.

Select Frame and Select Window documentation still todo.
  • Loading branch information
pekkaklarck authored and aaltat committed Oct 12, 2017
1 parent 1ba9326 commit febe886
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 294 deletions.
66 changes: 31 additions & 35 deletions src/SeleniumLibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,32 @@ class SeleniumLibrary(DynamicCore):
can either be explicitly specified with a prefix or the strategy can be
implicit.
=== Default locator strategy ===
By default locators are considered to use the keyword specific default
locator strategy. All keywords support finding elements based on ``id``
and ``name`` attributes, but some keywords support additional _key
attributes_ that make sense in their context. For example, `Click Link`
supports the link text and the ``href`` attribute in addition to the
normal ``id`` and ``name``.
Examples:
| `Click Element` | example | # Match based on ``id`` or ``name``. |
| `Click Link` | example | # Match also based on link text and ``href``. |
| `Click Button` | example | # Match based on ``id``, ``name`` or ``value``. |
If a locator accidentally starts with a prefix recognized as `explicit
locator strategy` or `implicit XPath strategy`, it is possible to use
the explicit ``default`` prefix to enable the default strategy.
Examples:
| `Click Element` | name:foo | # Find element with name ``foo``. |
| `Click Element` | default:name:foo | # Use default strategy with value ``name:foo``. |
| `Click Element` | //foo | # Find element using XPath ``//foo``. |
| `Click Element` | default://foo | # Use default strategy with value ``//foo``. |
=== Explicit locator strategy ===
The explicit locator strategy is specified with a prefix using either
Expand Down Expand Up @@ -109,8 +135,8 @@ class SeleniumLibrary(DynamicCore):
prefix is only necessary if the locator value itself accidentally
matches some of the explicit strategies.
Spaces around the separator are ignored, so ``id : foo``, ``id: foo``
and ``id:foo`` are all equivalent.
Spaces around the separator are ignored, so ``id:foo``, ``id: foo``
and ``id : foo`` are all equivalent.
Examples:
Expand All @@ -121,6 +147,9 @@ class SeleniumLibrary(DynamicCore):
Notice that using the ``sizzle`` strategy or its alias ``jquery``
requires that the system under test contains the jQuery library.
Notice also that prior to SeleniumLibrary 3.0, table related keywords
only supported ``xpath``, ``css`` and ``sizzle/jquery`` strategies.
=== Implicit XPath strategy ===
If the locator starts with ``//`` or ``(//``, the locator is considered
Expand All @@ -134,32 +163,6 @@ class SeleniumLibrary(DynamicCore):
The support for the ``(//`` prefix is new in SeleniumLibrary 3.0.
=== Default locator strategy ===
By default locators are considered to use the keyword specific default
locator strategy. All keywords support finding elements based on ``id``
and ``name`` attributes, but some keywords support additional _key
attributes_ that make sense in their context. For example, `Click Link`
supports the link text and the ``href`` attribute in addition to the
normal ``id`` and ``name``.
Examples:
| `Click Element` | example | # Match based on ``id`` or ``name``. |
| `Click Link` | example | # Match also based on link text and ``href``. |
| `Click Button` | example | # Match based on ``id``, ``name`` or ``value``. |
If the locator accidentally starts with some of the explicit locator
prefixes or with the implicit XPath prefixes, it is possible to use
the explicit ``default`` prefix to enable the default strategy.
Examples:
| `Click Element` | name:foo | # Find element with name ``foo``. |
| `Click Element` | default:name:foo | # Use default strategy with value ``name:foo``. |
| `Click Element` | //foo | # Find element using XPath ``//foo``. |
| `Click Element` | default://foo | # Use default strategy with value ``//foo``. |
== Using WebElements ==
In addition to specifying a locator as a string, it is possible to use
Expand Down Expand Up @@ -196,13 +199,6 @@ class SeleniumLibrary(DynamicCore):
See the `Add Location Strategy` keyword for more details.
== Locating tables ==
Starting from release 3.0.0, it is possible to locate table using all
strategies supported by the library. Prior the release 3.0 tables
could have been located with limited set of strategies and with
limitations in the strategy.
= Timeouts, waits and delays =
This section discusses different ways how to wait for elements to
Expand Down
Loading

0 comments on commit febe886

Please sign in to comment.