|
| def | execute_async_javascript (self, *code) |
| | Executes asynchronous JavaScript code with possible arguments. More...
|
| |
| def | execute_javascript (self, *code) |
| | Executes the given JavaScript code with possible arguments. 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 | __init__ (self, ctx) |
| | Base class exposing attributes from the common context. More...
|
| |
| 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 25 of file javascript.py.
| def SeleniumLibrary.keywords.javascript.JavaScriptKeywords.execute_async_javascript |
( |
|
self, |
|
|
* |
code |
|
) |
| |
Executes asynchronous JavaScript code with possible arguments.
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 the `Timeout` section for more information.
Starting from SeleniumLibrary 3.2 it is possible to provide JavaScript
[https://seleniumhq.github.io/selenium/docs/api/py/webdriver_remote/selenium.webdriver.remote.webdriver.html#selenium.webdriver.remote.webdriver.WebDriver.execute_async_script|
arguments] as part of ``code`` argument. See `Execute Javascript` for
more details.
Examples:
| `Execute Async JavaScript` | var callback = arguments[arguments.length - 1]; window.setTimeout(callback, 2000); |
| `Execute Async JavaScript` | ${CURDIR}/async_js_to_execute.js |
| ${result} = | `Execute Async JavaScript` |
| ... | var callback = arguments[arguments.length - 1]; |
| ... | function answer(){callback("text");}; |
| ... | window.setTimeout(answer, 2000); |
| `Should Be Equal` | ${result} | text |
Definition at line 98 of file javascript.py.
| def SeleniumLibrary.keywords.javascript.JavaScriptKeywords.execute_javascript |
( |
|
self, |
|
|
* |
code |
|
) |
| |
Executes the given JavaScript code with possible arguments.
``code`` may be divided into multiple cells in the test data and
``code`` may contain multiple lines of code and arguments. In that case,
the JavaScript code parts are concatenated together without adding
spaces and optional arguments are separated from ``code``.
If ``code`` is a 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. Use ``window``
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('example')``.
This keyword returns whatever the executed JavaScript code returns.
Return values are converted to the appropriate Python types.
Starting from SeleniumLibrary 3.2 it is possible to provide JavaScript
[https://seleniumhq.github.io/selenium/docs/api/py/webdriver_remote/selenium.webdriver.remote.webdriver.html#selenium.webdriver.remote.webdriver.WebDriver.execute_script|
arguments] as part of ``code`` argument. The JavaScript code and
arguments must be separated with `JAVASCRIPT` and `ARGUMENTS` markers
and must used exactly with this format. If the Javascript code is
first, then the `JAVASCRIPT` marker is optional. The order of
`JAVASCRIPT` and `ARGUMENTS` markers can swapped, but if `ARGUMENTS`
is first marker, then `JAVASCRIPT` marker is mandatory. It is only
allowed to use `JAVASCRIPT` and `ARGUMENTS` markers only one time in the
``code`` argument.
Examples:
| `Execute JavaScript` | window.myFunc('arg1', 'arg2') |
| `Execute JavaScript` | ${CURDIR}/js_to_execute.js |
| `Execute JavaScript` | alert(arguments[0]); | ARGUMENTS | 123 |
| `Execute JavaScript` | ARGUMENTS | 123 | JAVASCRIPT | alert(arguments[0]); |
Definition at line 68 of file javascript.py.