Constructor
new WebElement(uuid)
Parameters:
Name | Type | Description |
---|---|---|
uuid |
string | Identifier that must be unique across all browsing contexts for the contract to be upheld. |
- Source:
Methods
(static) from(node) → {ContentWebElement|ChromeWebElement}
Returns a new WebElement
reference for a DOM element,
WindowProxy
, or XUL element.
Parameters:
Name | Type | Description |
---|---|---|
node |
Element | WindowProxy | XULElement | Node to construct a web element reference for. |
- Source:
Throws:
-
If node is neither a
WindowProxy
, DOM element, or a XUL element. - Type
- InvalidArgumentError
Returns:
Web element reference for el.
(static) fromJSON(json) → {WebElement}
Unmarshals a JSON Object to one of ContentWebElement
,
ContentWebWindow
, ContentWebFrame
, or
ChromeWebElement
.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object.<string, string> | Web element reference, which is supposed to be a JSON Object
where the key is one of the |
- Source:
Throws:
-
If json is not a web element reference.
- Type
- InvalidArgumentError
Returns:
Representation of the web element.
- Type
- WebElement
(static) fromUUID(uuid, context) → {WebElement}
Constructs a ContentWebElement
or ChromeWebElement
from a a string uuid.
This whole function is a workaround for the fact that clients
to Marionette occasionally pass {id:
JSON
Objects instead of web element representations. For that reason
we need the context argument to determine what kind of
WebElement
to return.
Parameters:
Name | Type | Description |
---|---|---|
uuid |
string | UUID to be associated with the web element. |
context |
Context | Context, which is used to determine if the returned type should be a content web element or a chrome web element. |
- Source:
Throws:
-
If uuid is not a string or context is an invalid context.
- Type
- InvalidArgumentError
Returns:
One of ContentWebElement
or ChromeWebElement
,
based on context.
- Type
- WebElement
(static) generateUUID() → {string}
Generates a unique identifier.
- Source:
Returns:
UUID.
- Type
- string
(static) isReference(obj) → {boolean}
Checks if ref is a WebElement
reference,
i.e. if it has ContentWebElement.Identifier
,
ContentWebElement.LegacyIdentifier
, or
ChromeWebElement.Identifier
as properties.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object.<string, string> | Object that represents a reference to a |
- Source:
Returns:
True if obj is a WebElement
, false otherwise.
- Type
- boolean
is(other) → {boolean}
Performs an equality check between this web element and other.
Parameters:
Name | Type | Description |
---|---|---|
other |
WebElement | Web element to compare with this. |
- Source:
Returns:
True if this and other are the same. False otherwise.
- Type
- boolean