|
| def | __init__ (self, ctx) |
| | Base class exposing attributes from the common context. More...
|
| |
| def | close_window (self) |
| | Closes currently opened pop-up window. More...
|
| |
| def | get_locations (self) |
| | Returns and logs URLs of all known browser windows. More...
|
| |
| def | get_window_handles (self) |
| | Return all current window handles as a list. More...
|
| |
| def | get_window_identifiers (self) |
| | Returns and logs id attributes of all known browser windows. More...
|
| |
| def | get_window_names (self) |
| | Returns and logs names of all known browser windows. More...
|
| |
| def | get_window_position (self) |
| | Returns current window position. More...
|
| |
| def | get_window_size (self, inner=False) |
| | Returns current window width and height as integers. More...
|
| |
| def | get_window_titles (self) |
| | Returns and logs titles of all known browser windows. More...
|
| |
| def | maximize_browser_window (self) |
| | Maximizes current browser window. More...
|
| |
| def | select_window (self, locator='MAIN', timeout=None) |
| | Selects browser window matching locator. More...
|
| |
| def | set_window_position (self, x, y) |
| | Sets window position using x and y coordinates. More...
|
| |
| def | set_window_size (self, width, height, inner=False) |
| | Sets current windows size to given width and height. More...
|
| |
| def | assert_page_contains (self, locator, tag=None, message=None, loglevel='TRACE') |
| |
| def | assert_page_not_contains (self, locator, tag=None, message=None, loglevel='TRACE') |
| |
| def | debug (self, msg, html=False) |
| |
| def | get_timeout (self, timeout=None) |
| |
| def | info (self, msg, html=False) |
| |
| def | log (self, msg, level='INFO', html=False) |
| |
| def | log_source (self, loglevel='INFO') |
| |
| def | warn (self, msg, html=False) |
| |
| def | find_element (self, locator, tag=None, required=True, parent=None) |
| | Find element matching locator. More...
|
| |
| def | find_elements (self, locator, tag=None, parent=None) |
| | Find all elements matching locator. More...
|
| |
| def | is_element_enabled (self, locator, tag=None) |
| |
| def | is_text_present (self, text) |
| |
| def | is_visible (self, locator) |
| |
Definition at line 26 of file window.py.
| def SeleniumLibrary.keywords.window.WindowKeywords.get_window_size |
( |
|
self, |
|
|
|
inner = False |
|
) |
| |
Returns current window width and height as integers.
See also `Set Window Size`.
If ``inner`` parameter is set to True, keyword returns
HTML DOM window.innerWidth and window.innerHeight properties.
See `Boolean arguments` for more details how to set boolean
arguments. The ``inner`` is new in SeleniumLibrary 4.0.
Example:
| ${width} | ${height}= | `Get Window Size` | |
| ${width} | ${height}= | `Get Window Size` | True |
Definition at line 172 of file window.py.
| def SeleniumLibrary.keywords.window.WindowKeywords.select_window |
( |
|
self, |
|
|
|
locator = 'MAIN', |
|
|
|
timeout = None |
|
) |
| |
Selects browser window matching locator.
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 ``locator`` can be specified using different strategies somewhat
similarly as when `locating elements` on pages.
- By default the ``locator`` is matched against window handle, name,
title, and URL. Matching is done in that order and the the first
matching window is selected.
- The ``locator`` can specify an explicit strategy by using format
``strategy:value`` (recommended) or ``strategy=value``. Supported
strategies are ``name``, ``title`` and ``url``, which match windows
using name, title, and URL, respectively. Additionally, ``default``
can be used to explicitly use the default strategy explained above.
- If the ``locator`` is ``NEW`` (case-insensitive), the latest
opened window is selected. It is an error if this is the same
as the current window.
- If the ``locator`` is ``MAIN`` (default, case-insensitive),
the main window is selected.
- If the ``locator`` is ``CURRENT`` (case-insensitive), nothing is
done. This effectively just returns the current window handle.
- If the ``locator`` is not a string, it is expected to be a list
of window handles _to exclude_. Such a list of excluded windows
can be get from `Get Window Handles` prior to doing an action that
opens a new window.
The ``timeout`` is used to specify how long keyword will poll to select
the new window. The ``timeout`` is new in SeleniumLibrary 3.2.
Example:
| `Click Link` | popup1 | | # Open new window |
| `Select Window` | example | | # Select window using default strategy |
| `Title Should Be` | Pop-up 1 | |
| `Click Button` | popup2 | | # Open another window |
| ${handle} = | `Select Window` | NEW | # Select latest opened window |
| `Title Should Be` | Pop-up 2 | |
| `Select Window` | ${handle} | | # Select window using handle |
| `Title Should Be` | Pop-up 1 | |
| `Select Window` | MAIN | | # Select the main window |
| `Title Should Be` | Main | |
| ${excludes} = | `Get Window Handles` | | # Get list of current windows |
| `Click Link` | popup3 | | # Open one more window |
| `Select Window` | ${excludes} | | # Select window using excludes |
| `Title Should Be` | Pop-up 3 | |
*NOTE:*
- The ``strategy:value`` syntax is only supported by SeleniumLibrary
3.0 and newer.
- Prior to SeleniumLibrary 3.0 matching windows by name, title
and URL was case-insensitive.
- Earlier versions supported aliases ``None``, ``null`` and the
empty string for selecting the main window, and alias ``self``
for selecting the current window. Support for these aliases were
removed in SeleniumLibrary 3.2.
Definition at line 104 of file window.py.
| def SeleniumLibrary.keywords.window.WindowKeywords.set_window_position |
( |
|
self, |
|
|
|
x, |
|
|
|
y |
|
) |
| |
Sets window position using x and y coordinates.
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 Position` | 100 | 200 |
Definition at line 249 of file window.py.
| def SeleniumLibrary.keywords.window.WindowKeywords.set_window_size |
( |
|
self, |
|
|
|
width, |
|
|
|
height, |
|
|
|
inner = False |
|
) |
| |
Sets current windows size to given width and height.
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.
If ``inner`` parameter is set to True, keyword sets the necessary
window width and height to have the desired HTML DOM window.innerWidth
and window.innerHeight The ``inner`` is new in SeleniumLibrary 4.0.
See `Boolean arguments` for more details how to set boolean
arguments.
This ``inner`` argument does not support Frames. If a frame is selected,
switch to default before running this.
Example:
| `Set Window Size` | 800 | 600 | |
| `Set Window Size` | 800 | 600 | True |
Definition at line 203 of file window.py.