-
Notifications
You must be signed in to change notification settings - Fork 7
Session
The Session object represents a single instantiation of the user-agent, in this case jsdom
-
- id - A UUID v1 which uniquely identifies the Session Object
- pageLoadStrategy - a string which specifies the session's page loading strategy. It defaults to 'normal'.
- secureTLS - boolean property indicating whether untrusted or self-signed TLS certificates should be trusted for the duration of the Session object. A false value indicates that certificate or TLS errors should be suppressed.
- timeouts - property which contains the sessions implicit, pageload and script timeouts. Unless otherwise specified, these default to 0 ms, 30000 ms and 30000 ms, respectively.
- mutex - a [Mutex] object which serves as the Session object's request queue. This is used to queue requests currently awaiting processing. Ensures that requests made to the session occur in a First In First Out order.
- browser - a Browser object. The remote end-point node which contains the jsdom object.
-
-
process(request) - accepts a string which identifies a command to be executed. Returns a promise which is resolved once the request logic has completed execution.
-
navigateTo({url}) - destructs the argument object to obtain a url string. Starts a pageLoad timer, passes the validated url to the browser object and tries to fetch the resource before the timer runs out. Throws an InvalidArgument error if passed an invalid url or a Timeout error if it fails to fetch the resource before the specified pageload timeout.
-
setTimeouts(timeouts) - accepts and validates an object with pageLoad, script and/or implicit timeout properties. Sets the session's corresponding timeout values if valid. Throws an InvalidArgument error otherwise.
-
getTimeouts() - returns the active session's configured timeouts object.
-
configureSession(requestedCapabilties) - Method called by the Session constructor. Accepts the HTTP request body forwards it to the configureCapabilties method which configures the Session objects capabilties. It uses the configured capabilities object to extract jsdom specific capabilties and instantiates a broswer object.
-
configureCapabilities(requestedCapabilties) - accepts the HTTP request body and forwards it to processCapabilities which returns an object with validated capabilties or null otherwise. Uses the validated capabilties object to configure the Session object's capabilties.
-
processCapabilties(requestedCapabilties) - accepts the HTTP request body and uses a CapabilityValidator object to validate firstMatch and alwaysMatch requested capabilties. Calls mergeCapabilties to merge validated firstMatch and alwaysMatch then proceeds to call matchCapabilties which matches supported capabilties, returns validated and matched capabilities.
-
mergeCapabilties(primary, secondary) - returns the result of merging alwaysMatch capabilities (primary) and firstMatch capabilties (secondary).
-
matchCapabilities(capabilties) - accepts a validated and merged capabilties object. Returns an object with the matched, supported capabilties.
-
elementRetrieval(startNode, strategy, selector) - accepts and uses a known WebElement (startNode), a strategy (string) and a selector to find elements within the DOM created by the Browser object.
-
executeScript(script, args) Creates a function from the provided script argument (string) and passes the parameters contained within the args object to the newly created function. Executes the function within the DOM object created by the remote end node (jsdom)
-
sendKeysToElement(text, elementId) Accepts a string containing user provided text along with an elementId where the text will be inserted if valid.
-