.elementActive() Suggest edits
Get the element on the page that currently has focus. The element will be returned as a Web Element JSON object.
The command elementActive() will automatically wait for the element to be present (until the specified timeout). If the element is not found, an error is thrown which will cause the test to fail. You can suppress element not found errors by specifying the selector argument as an object and passing the suppressNotFoundErrors = true option.
Please note that this command operates on a protocol level and accepts the Web Element ID as the parameter. To retrieve it, use either the .findElement() or .findElements() command. Read more on Element retrieval.
Usage
Example
module.exports = {
'demo Test' : function(browser) {
browser.elementActive(function(result) {
console.log(result.value)
});
}
}
Parameters
| Name | Type | description |
|---|---|---|
callback |
function | Callback function which is called with the result value. |