Internal.Driver Class
Native Webdriver base class
Item Index
Methods
- _concatDataChunks
- _generateWebdriverCommand
- _mapParams
- _onError
- _onResponse
- _onResponseEnd
- _onSuccess
- _replacePlaceholderInUrl
- acceptAlert
- activatedEngine
- activateEngine
- active
- activeEngine
- addCommand
- alertText
- applicationCacheStatus
- asyncScript
- availableEngines
- back
- buttonClick
- buttondown
- buttonup
- changeWindow
- childElement
- clear
- click
- close
- createSession
- cssProperty
- deactivateEngine
- dismissAlert
- displayed
- doubleclickPage
- doubletap
- element
- element
- elementInfo
- elements
- enabled
- equals
- execute
- executeAsync
- flick
- forward
- frame
- generateBody
- generateParamset
- generateRequestOptions
- geoLocation
- getAttribute
- getCookie
- getCookies
- getLocalStorage
- getLocalStorageSize
- getSessionStorage
- getSessionStorageEntry
- getSessionStorageSize
- getUrl
- getWindowPosition
- getWindowSize
- implicitWait
- location
- locationInView
- log
- logTypes
- longpress
- moveto
- name
- orientation
- parseUrl
- promptText
- refresh
- screenshot
- selected
- sendKeys
- session
- session
- sessions
- setCookie
- setGeoLocation
- setLocalStorage
- setWindowPosition
- setWindowSize
- size
- source
- status
- submit
- tap
- text
- timeouts
- title
- touchdown
- touchmove
- touchscroll
- touchup
- url
- val
- windowHandle
- windowHandles
- windowMaximize
Methods
_concatDataChunks
-
chunk
Concatenates chunks of strings
Parameters:
-
chunkStringString to add
Returns:
data Concatenated string
_generateWebdriverCommand
-
remote -
driver
Generates the webdriver callback function
Parameters:
-
remoteObjectDummy request body (function name, url, method)
-
driverDalekJs.Internal.DriverDriver instance
Returns:
webdriverCommand Generated webdriver command function
_mapParams
-
providedParams -
params -
param -
idx
Mpas object values & keys of two objects
Parameters:
-
providedParamsObjectValues for the paramset
-
paramsObjectThe object to be filled
-
paramStringThe key of the output object
-
idxIntegerIndex of the iteration
Returns:
params Params for the message body
_onError
-
driver -
response -
remote -
options -
deferred
On error callback function
Parameters:
-
driverDalekJs.Internal.DriverDriver instance
-
responseObjectResponse from the webdriver server
-
remoteObjectDummy request body (function name, url, method)
-
optionsObjectRequest options (method, port, path, headers, etc.)
-
deferredObjectWebdriver command deferred
_onResponse
-
driver -
remote -
options -
deferred -
response
Response callback function
Parameters:
-
driverDalekJs.Internal.DriverDriver instance
-
remoteObjectDummy request body (function name, url, method)
-
optionsObjectRequest options (method, port, path, headers, etc.)
-
deferredObjectWebdriver command deferred
-
responseObjectResponse from the webdriver server
_onResponseEnd
-
driver -
response -
remote -
options -
deferred
Response end callback function
Parameters:
-
driverDalekJs.Internal.DriverDriver instance
-
responseObjectResponse from the webdriver server
-
remoteObjectDummy request body (function name, url, method)
-
optionsObjectRequest options (method, port, path, headers, etc.)
-
deferredObjectWebdriver command deferred
_onSuccess
-
driver -
response -
remote -
options -
deferred
On success callback function
Parameters:
-
driverDalekJs.Internal.DriverDriver instance
-
responseObjectResponse from the webdriver server
-
remoteObjectDummy request body (function name, url, method)
-
optionsObjectRequest options (method, port, path, headers, etc.)
-
deferredObjectWebdriver command deferred
_replacePlaceholderInUrl
-
options -
url -
option
Replaces placeholders in urls
Parameters:
-
optionsObjectList of url options
-
urlStringURL with placeholders
-
optionStringOption to process
Returns:
url Parsed URL
acceptAlert
-
sessionId
Accept an dialog box
Parameters:
-
sessionIdGETID of the session to route the command to
activatedEngine
-
sessionId
Indicates whether IME input is active at the moment
Parameters:
-
sessionIdGETID of the session to route the command to
activateEngine
-
sessionId -
engine
Make an engines that is available (appears on the list returned by getAvailableEngines) active. After this call, the engine will be added to the list of engines loaded in the IME daemon and the input sent using sendKeys will be converted by the active engine. Note that this is a platform-independent method of activating IME (the platform-specific way being using keyboard shortcuts)
Parameters:
-
sessionIdGETID of the session to route the command to
-
enginePOSTName of the engine to activate
active
-
sessionId -
id
Get the element on the page that currently has focus. The element will be returned as a WebElement JSON object.
Parameters:
-
sessionIdGETID of the session to route the command to
-
idGETID of the element to route the command to
activeEngine
-
sessionId
Get the name of the active IME engine. The name string is platform specific.
Parameters:
-
sessionIdGETID of the session to route the command to
addCommand
-
remote
Generates a new webdriver client command Takes a skeleton of obtions that will be converted into a new function that can be invoked & will issue a webdriver command to the webdriver server
Parameters:
-
remoteObjectObject skeleton that will be turned into a webdriver client method
alertText
-
sessionId
Checks a prompt text
Parameters:
-
sessionIdGETID of the session to route the command to
applicationCacheStatus
-
sessionId
Get the status of the html5 application cache.
Parameters:
-
sessionIdGETID of the session to route the command to
asyncScript
-
sessionId -
ms
Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async are permitted to run before they are aborted and a |Timeout| error is returned to the client.
Parameters:
-
sessionIdGETID of the session to route the command to
-
msPOSTThe amount of time to wait, in milliseconds. This value has a lower bound of 0
availableEngines
-
sessionId
List all available engines on the machine. To use an engine, it has to be present in this list.
Parameters:
-
sessionIdGETID of the session to route the command to
back
-
sessionId
Navigate backwards in the browser history, if possible
Parameters:
-
sessionIdGETID of the session to route the command to
changeWindow
-
sessionId -
name
Change focus to another window. The window to change focus to may be specified by its server assigned window handle, or by the value of its name attribute.
Parameters:
-
sessionIdGETID of the session to route the command to
-
namePOSTName of the window to switch to
childElement
-
sessionId -
elementId -
using -
value
Search for an element on the page, starting from the identified element. The located element will be returned as a WebElement JSON object. The table below lists the locator strategies that each server should support. Each locator must return the first matching element located in the DOM.
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
-
usingPOSTThe locator strategy to use. // Not yet supported
-
valuePOSTThe The search target.
clear
-
sessionId -
elementId
Clear a TEXTAREA or text INPUT element's value
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
click
-
sessionId -
id
Click on an element.
Parameters:
-
sessionIdGETID of the session to route the command to
-
idGETID of the element to route the command to
close
-
sessionId
Closes the current window.
Parameters:
-
sessionIdGETID of the session to route the command to
createSession
-
desiredCapabilities -
requiredCapabilities
Create a new session. The server should attempt to create a session that most closely matches the desired and required capabilities. Required capabilities have higher priority than desired capabilities and must be set for the session to be created.
Parameters:
-
desiredCapabilitiesPOSTAn object describing the session's desired capabilities.
-
requiredCapabilitiesPOSTAn object describing the session's required capabilities
cssProperty
-
sessionId -
elementId -
propertyName
Query the value of an element's computed CSS property. The CSS property to query should be specified using the CSS property name, not the JavaScript property name (e.g. background-color instead of backgroundColor).
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
-
propertyNameGETName of the css property to fetch
deactivateEngine
-
sessionId
De-activates the currently-active IME engine
Parameters:
-
sessionIdGETID of the session to route the command to
dismissAlert
-
sessionId
Cancel an dialog box
Parameters:
-
sessionIdGETID of the session to route the command to
displayed
-
sessionId -
elementId
Determine an element's location on the page. The point (0, 0) refers to the upper-left corner of the page. The element's coordinates are returned as a JSON object with x and y properties.
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
doubleclickPage
-
sessionId
Double-clicks at the current mouse coordinates (set by moveto).
Parameters:
-
sessionIdGETID of the session to route the command to
doubletap
-
sessionId
Double tap on the touch screen using finger motion events.
Parameters:
-
sessionIdGETID of the session to route the command to
element
-
sessionId -
elementId -
using -
value
Search for an element on the page, starting from the identified element. The located element will be returned as a WebElement JSON object. The table below lists the locator strategies that each server should support. Each locator must return the first matching element located in the DOM.
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
-
usingPOSTThe locator strategy to use. // Not yet supported
-
valuePOSTThe The search target.
element
-
sessionId -
selector
Search for an element on the page, starting from the document root. The located element will be returned as a WebElement JSON object.
Parameters:
-
sessionIdGETID of the session to route the command to
-
selectorPOSTThe The search target.
elementInfo
-
sessionId -
elementId
Get the element on the page that currently has focus. The element will be returned as a WebElement JSON object.
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
elements
-
sessionId -
selector
Search for multiple elements on the page, starting from the document root. The located element will be returned as a WebElement JSON object.
Parameters:
-
sessionIdGETID of the session to route the command to
-
selectorPOSTThe The search target.
enabled
-
sessionId -
elementId
Determine if an element is currently enabled
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
equals
-
sessionId -
elementId -
other
Test if two element IDs refer to the same DOM element
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
-
otherGETID of the element to compare
execute
-
sessionId -
script -
args
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. The executed script is assumed to be synchronous and the result of evaluating the script is returned to the client. The script argument defines the script to execute in the form of a function body. The value returned by that function will be returned to the client. The function will be invoked with the provided args array and the values may be accessed via the arguments object in the order specified.
Parameters:
-
sessionIdGETID of the session to route the command to
-
scriptPOSTThe script to execute.
-
argsPOSTThe script arguments.
executeAsync
-
sessionId -
script -
args
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. The executed script is assumed to be asynchronous and must signal that is done by invoking the provided callback, which is always provided as the final argument to the function. The value to this callback will be returned to the client. Asynchronous script commands may not span page loads. If an unload event is fired while waiting for a script result, an error should be returned to the client.
The script argument defines the script to execute in teh form of a function body. The function will be invoked with the provided args array and the values may be accessed via the arguments object in the order specified. The final argument will always be a callback function that must be invoked to signal that the script has finished.
Parameters:
-
sessionIdGETID of the session to route the command to
-
scriptPOSTThe script to execute.
-
argsPOSTThe script arguments.
flick
-
sessionId -
element -
xoffset -
yoffset -
speed
Flick on the touch screen using finger motion events. This flickcommand starts at a particulat screen location.
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementPOSTID of the element where the flick starts
-
xoffsetPOSTThe x offset in pixels to flick by
-
yoffsetPOSTThe y offset in pixels to flick by
-
speedPOSTThe speed in pixels per seconds
forward
-
sessionId
Navigate forwards in the browser history, if possible.
Parameters:
-
sessionIdGETID of the session to route the command to
frame
-
sessionId -
id
Change focus to another frame on the page. If the frame id is null, the server should switch to the page's default content.
Parameters:
-
sessionIdGETID of the session to route the command to
-
idPOSTIdentifier for the frame to change focus to.
generateBody
-
options -
cb -
wd -
params
Generates the message body for webdriver client requests of type POST
Parameters:
-
optionsObjectBrowser options (name, bin path, etc.)
-
cbFunction | UndefinedCallback function that should be invoked to generate the message body
-
wdDalek.Internal.WebdriverWebdriver base object
-
paramsObjectParameters that should be part of the message body
Returns:
body Serialized JSON of body request data
generateParamset
-
requestedParams -
providedParams
Generates a set of params for the message body of the request
Parameters:
-
requestedParamsObject | NullKeys & placeholders for the paramset
-
providedParamsObjectValues for the paramset
Returns:
params Params for the message body
generateRequestOptions
-
hostname -
port -
prefix -
url -
method -
body
Generates the request options for a webdriver client request
Parameters:
-
hostnameStringHostname of the webdriver server
-
portIntegerPort of the webdriver server
-
prefixStringUrl address prefix of the webdriver endpoint
-
urlStringUrl of the webdriver method
-
methodStringRequest method e.g. (GET, POST, DELETE, PUT)
-
bodyStringThe message body of the request
Returns:
options Request options
geoLocation
-
sessionId
Get the current geo location
Parameters:
-
sessionIdGETID of the session to route the command to
getAttribute
-
sessionId -
elementId -
attr
Get the value of an element's attribute.
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
-
attrGETAttribute that should be fetched
getCookie
-
sessionId -
name
Retrieve a cookies by its name.
Parameters:
-
sessionIdGETID of the session to route the command to
-
nameGETName of the cookie
getCookies
-
sessionId
Retrieve all cookies visible to the current page.
Parameters:
-
sessionIdGETID of the session to route the command to
getLocalStorage
-
sessionId
Get all keys of the browsers local storage
Parameters:
-
sessionIdGETID of the session to route the command to
getLocalStorageSize
-
sessionId
Get the number of items in the storage
Parameters:
-
sessionIdGETID of the session to route the command to
getSessionStorage
-
sessionId
Get all keys of the browsers session storage
Parameters:
-
sessionIdGETID of the session to route the command to
getSessionStorageEntry
-
sessionId -
key
Get the storage item for the given key
Parameters:
-
sessionIdGETID of the session to route the command to
-
keyGETThe key to get
getSessionStorageSize
-
sessionId
Get the number of items in the storage
Parameters:
-
sessionIdGETID of the session to route the command to
getUrl
-
sessionId
Retrieve the URL of the current page
Parameters:
-
sessionIdGETID of the session to route the command to
getWindowPosition
-
sessionId -
windowHandle
Get the position of the specified window. If the :windowHandle URL parameter is "current", the position of the currently active window will be returned.
Parameters:
-
sessionIdGETID of the session to route the command to
-
windowHandleGETID of the window to route the command to
getWindowSize
-
sessionId -
windowHandle
Get the size of the specified window. If the :windowHandle URL parameter is "current", the size of the currently active window will be returned.
Parameters:
-
sessionIdGETID of the session to route the command to
-
windowHandleGETID of the window to route the command to
implicitWait
-
sessionId -
ms
Set the amount of time the driver should wait when searching for elements. When searching for a single element, the driver should poll the page until an element is found or the timeout expires, whichever occurs first. When searching for multiple elements, the driver should poll the page until at least one element is found or the timeout expires, at which point it should return an empty list.
Parameters:
-
sessionIdGETID of the session to route the command to
-
msPOSTThe amount of time to wait, in milliseconds. This value has a lower bound of 0
location
-
sessionId -
elementId
Determine an element's location on the page. The point (0, 0) refers to the upper-left corner of the page. The element's coordinates are returned as a JSON object with x and y properties.
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
locationInView
-
sessionId -
elementId
Determine an element's location on the screen once it has been scrolled into view. Note: This is considered an internal command and should only be used to determine an element's location for correctly generating native events.
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
log
-
sessionId
Get the log for a given log type. Log buffer is reset after each request.
Parameters:
-
sessionIdGETID of the session to route the command to
logTypes
-
sessionId
Get available log types
Parameters:
-
sessionIdGETID of the session to route the command to
longpress
-
sessionId
Long press on the touch screen using finger motion events.
Parameters:
-
sessionIdGETID of the session to route the command to
moveto
-
sessionId -
element -
xoffset -
yoffset
Move the mouse by an offset of the specificed element. If no element is specified, the move is relative to the current mouse cursor. If an element is provided but no offset, the mouse will be moved to the center of the element. If the element is not visible, it will be scrolled into view.
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementPOSTOpaque ID assigned to the element to move to, as described in the WebElement JSON Object. If not specified or is null, the offset is relative to current position of the mouse.
-
xoffsetPOSTX offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element.
-
yoffsetPOSTY offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element.
name
-
sessionId -
elementId
Query for an element's tag name
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
orientation
-
sessionId
Checks the device orientation
Parameters:
-
sessionIdGETID of the session to route the command to
parseUrl
-
url -
options
Parses an JSON Wire protocol dummy url
Parameters:
-
urlStringURL with placeholders
-
optionsObjectList of url options
Returns:
url Parsed URL
promptText
-
sessionId -
text
Sets a prompt text
Parameters:
-
sessionIdGETID of the session to route the command to
-
textPOSTText to set
refresh
-
sessionId
Refresh the current page
Parameters:
-
sessionIdGETID of the session to route the command to
screenshot
-
sessionId
Take a screenshot of the current page.
Parameters:
-
sessionIdGETID of the session to route the command to
selected
-
sessionId -
elementId
Determine if an OPTION element, or an INPUT element of type checkbox or radiobutton is currently selected
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
sendKeys
-
sessionId -
id -
text
Get the log for a given log type. Log buffer is reset after each request.
Parameters:
-
sessionIdGETID of the session to route the command to
-
idGETID of the element to route the command to
-
textPOSTThe keys sequence to be sent
session
-
sessionId
Retrieve the capabilities of the specified session.
Parameters:
-
sessionIdGETID of the session to route the command to
session
-
sessionId
Delete the session.
Parameters:
-
sessionIdGETID of the session to route the command to
sessions
()
Returns a list of the currently active sessions
setCookie
-
sessionId -
cookie
Set a cookie. If the cookie path is not specified, it should be set to "/". Likewise, if the domain is omitted, it should default to the current page's domain.
Parameters:
-
sessionIdGETID of the session to route the command to
-
cookiePOSTThe cookie object
setGeoLocation
-
sessionId -
latitude -
longitude -
altitude
Set the geo location
Parameters:
-
sessionIdGETID of the session to route the command to
-
latitudePOSTThe new location
-
longitudePOSTThe new location
-
altitudePOSTThe new location
setLocalStorage
-
sessionId -
key -
value
Set the storage item for the given key
Parameters:
-
sessionIdGETID of the session to route the command to
-
keyPOSTThe key to set
-
valuePOSTThe value to set
setWindowPosition
-
sessionId -
x -
y
Set the position of the specified window.
Parameters:
-
sessionIdPOSTID of the session to route the command to
-
xPOSTThe X coordinates for the window, relative to the upper left corner of the screen.
-
yPOSTThe Y coordinates for the window, relative to the upper left corner of the screen.
setWindowSize
-
sessionId -
windowHandle -
width -
height
Change the size of the specified window. If the :windowHandle URL parameter is "current", the currently active window will be resized.
Parameters:
-
sessionIdPOSTID of the session to route the command to
-
windowHandlePOSTID of the window to route the command to
-
widthPOSTThe new window width
-
heightPOSTThe new window height
size
-
sessionId -
elementId
Determine an element's size in pixels. The size will be returned as a JSON object with width and height properties.
Parameters:
-
sessionIdGETID of the session to route the command to
-
elementIdGETID of the element to route the command to
source
-
sessionId
Get the current page source
Parameters:
-
sessionIdGETID of the session to route the command to
status
()
Query the server's current status. The server should respond with a general "HTTP 200 OK" response if it is alive and accepting commands. The response body should be a JSON object describing the state of the server. All server implementations should return two basic objects describing the server's current platform and when the server was built. All fields are optional; if omitted, the client should assume the value is uknown. Furthermore, server implementations may include additional fields not listed here.
submit
-
sessionId -
id
Submit a FORM element. The submit command may also be applied to any element that is a descendant of a FORM element.
Parameters:
-
sessionIdGETID of the session to route the command to
-
idGETID of the element to route the command to
tap
-
sessionId
Single tap on the touch enabled device.
Parameters:
-
sessionIdGETID of the session to route the command to
text
-
sessionId -
id
Returns the visible text for the element.
Parameters:
-
sessionIdGETID of the session to route the command to
-
idGETID of the element to route the command to
timeouts
-
sessionId -
type -
ms
Configure the amount of time that a particular type of operation can execute for before they are aborted and a |Timeout| error is returned to the client.
Parameters:
-
sessionIdGETID of the session to route the command to
-
typePOSTThe type of operation to set the timeout for. Valid values are: "script" for script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting a page load timeout
-
msPOSTThe amount of time to wait, in milliseconds. This value has a lower bound of 0
title
-
sessionId
Get the current page title
Parameters:
-
sessionIdGETID of the session to route the command to
touchdown
-
sessionId -
x -
y
Finger down on the screen.
Parameters:
-
sessionIdGETID of the session to route the command to
-
xPOSTX coordinate on the screen.
-
yPOSTY coordinate on the screen.
touchmove
-
sessionId -
x -
y
Finger move on the screen.
Parameters:
-
sessionIdGETID of the session to route the command to
-
xPOSTX coordinate on the screen.
-
yPOSTY coordinate on the screen.
touchscroll
-
sessionId -
x -
y
Scroll on the touch screen using finger based motion events. Use this command if you don't care where the scroll starts on the screen.
Parameters:
-
sessionIdGETID of the session to route the command to
-
xPOSTX coordinate on the screen.
-
yPOSTY coordinate on the screen.
touchup
-
sessionId -
x -
y
Finger up on the screen.
Parameters:
-
sessionIdGETID of the session to route the command to
-
xPOSTX coordinate on the screen.
-
yPOSTY coordinate on the screen.
url
-
sessionId -
page
Navigate to a new URL
Parameters:
-
sessionIdGETID of the session to route the command to
-
pagePOSTThe URL to navigate to.
val
-
sessionId -
id -
text
Send a sequence of key strokes to an element
Parameters:
-
sessionIdGETID of the session to route the command to
-
idGETID of the element to route the command to
-
textPOSTThe keys sequence to be sent
windowHandle
-
sessionId
Retrieve the current window handle.
Parameters:
-
sessionIdGETID of the session to route the command to
windowHandles
-
sessionId
Retrieve the list of all window handles available to the session.
Parameters:
-
sessionIdGETID of the session to route the command to
windowMaximize
-
sessionId -
windowHandle
Maximize the specified window if not already maximized. If the :windowHandle URL parameter is "current", the currently active window will be maximized.
Parameters:
-
sessionIdGETID of the session to route the command to
-
windowHandleGETID of the window to route the command to
