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:
-
chunk
StringString to add
Returns:
data Concatenated string
_generateWebdriverCommand
-
remote
-
driver
Generates the webdriver callback function
Parameters:
-
remote
ObjectDummy request body (function name, url, method)
-
driver
DalekJs.Internal.DriverDriver instance
Returns:
webdriverCommand Generated webdriver command function
_mapParams
-
providedParams
-
params
-
param
-
idx
Mpas object values & keys of two objects
Parameters:
-
providedParams
ObjectValues for the paramset
-
params
ObjectThe object to be filled
-
param
StringThe key of the output object
-
idx
IntegerIndex of the iteration
Returns:
params Params for the message body
_onError
-
driver
-
response
-
remote
-
options
-
deferred
On error callback function
Parameters:
-
driver
DalekJs.Internal.DriverDriver instance
-
response
ObjectResponse from the webdriver server
-
remote
ObjectDummy request body (function name, url, method)
-
options
ObjectRequest options (method, port, path, headers, etc.)
-
deferred
ObjectWebdriver command deferred
_onResponse
-
driver
-
remote
-
options
-
deferred
-
response
Response callback function
Parameters:
-
driver
DalekJs.Internal.DriverDriver instance
-
remote
ObjectDummy request body (function name, url, method)
-
options
ObjectRequest options (method, port, path, headers, etc.)
-
deferred
ObjectWebdriver command deferred
-
response
ObjectResponse from the webdriver server
_onResponseEnd
-
driver
-
response
-
remote
-
options
-
deferred
Response end callback function
Parameters:
-
driver
DalekJs.Internal.DriverDriver instance
-
response
ObjectResponse from the webdriver server
-
remote
ObjectDummy request body (function name, url, method)
-
options
ObjectRequest options (method, port, path, headers, etc.)
-
deferred
ObjectWebdriver command deferred
_onSuccess
-
driver
-
response
-
remote
-
options
-
deferred
On success callback function
Parameters:
-
driver
DalekJs.Internal.DriverDriver instance
-
response
ObjectResponse from the webdriver server
-
remote
ObjectDummy request body (function name, url, method)
-
options
ObjectRequest options (method, port, path, headers, etc.)
-
deferred
ObjectWebdriver command deferred
_replacePlaceholderInUrl
-
options
-
url
-
option
Replaces placeholders in urls
Parameters:
-
options
ObjectList of url options
-
url
StringURL with placeholders
-
option
StringOption to process
Returns:
url Parsed URL
acceptAlert
-
sessionId
Accept an dialog box
Parameters:
-
sessionId
GETID of the session to route the command to
activatedEngine
-
sessionId
Indicates whether IME input is active at the moment
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
engine
POSTName 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:
-
sessionId
GETID of the session to route the command to
-
id
GETID 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:
-
sessionId
GETID 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:
-
remote
ObjectObject skeleton that will be turned into a webdriver client method
alertText
-
sessionId
Checks a prompt text
Parameters:
-
sessionId
GETID of the session to route the command to
applicationCacheStatus
-
sessionId
Get the status of the html5 application cache.
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
ms
POSTThe 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:
-
sessionId
GETID of the session to route the command to
back
-
sessionId
Navigate backwards in the browser history, if possible
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
name
POSTName 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:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID of the element to route the command to
-
using
POSTThe locator strategy to use. // Not yet supported
-
value
POSTThe The search target.
clear
-
sessionId
-
elementId
Clear a TEXTAREA or text INPUT element's value
Parameters:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID of the element to route the command to
click
-
sessionId
-
id
Click on an element.
Parameters:
-
sessionId
GETID of the session to route the command to
-
id
GETID of the element to route the command to
close
-
sessionId
Closes the current window.
Parameters:
-
sessionId
GETID 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:
-
desiredCapabilities
POSTAn object describing the session's desired capabilities.
-
requiredCapabilities
POSTAn 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:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID of the element to route the command to
-
propertyName
GETName of the css property to fetch
deactivateEngine
-
sessionId
De-activates the currently-active IME engine
Parameters:
-
sessionId
GETID of the session to route the command to
dismissAlert
-
sessionId
Cancel an dialog box
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID of the element to route the command to
doubleclickPage
-
sessionId
Double-clicks at the current mouse coordinates (set by moveto).
Parameters:
-
sessionId
GETID of the session to route the command to
doubletap
-
sessionId
Double tap on the touch screen using finger motion events.
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID of the element to route the command to
-
using
POSTThe locator strategy to use. // Not yet supported
-
value
POSTThe 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:
-
sessionId
GETID of the session to route the command to
-
selector
POSTThe 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:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
selector
POSTThe The search target.
enabled
-
sessionId
-
elementId
Determine if an element is currently enabled
Parameters:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID of the element to route the command to
equals
-
sessionId
-
elementId
-
other
Test if two element IDs refer to the same DOM element
Parameters:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID of the element to route the command to
-
other
GETID 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:
-
sessionId
GETID of the session to route the command to
-
script
POSTThe script to execute.
-
args
POSTThe 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:
-
sessionId
GETID of the session to route the command to
-
script
POSTThe script to execute.
-
args
POSTThe 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:
-
sessionId
GETID of the session to route the command to
-
element
POSTID of the element where the flick starts
-
xoffset
POSTThe x offset in pixels to flick by
-
yoffset
POSTThe y offset in pixels to flick by
-
speed
POSTThe speed in pixels per seconds
forward
-
sessionId
Navigate forwards in the browser history, if possible.
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
id
POSTIdentifier for the frame to change focus to.
generateBody
-
options
-
cb
-
wd
-
params
Generates the message body for webdriver client requests of type POST
Parameters:
-
options
ObjectBrowser options (name, bin path, etc.)
-
cb
Function | UndefinedCallback function that should be invoked to generate the message body
-
wd
Dalek.Internal.WebdriverWebdriver base object
-
params
ObjectParameters 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:
-
requestedParams
Object | NullKeys & placeholders for the paramset
-
providedParams
ObjectValues 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:
-
hostname
StringHostname of the webdriver server
-
port
IntegerPort of the webdriver server
-
prefix
StringUrl address prefix of the webdriver endpoint
-
url
StringUrl of the webdriver method
-
method
StringRequest method e.g. (GET, POST, DELETE, PUT)
-
body
StringThe message body of the request
Returns:
options Request options
geoLocation
-
sessionId
Get the current geo location
Parameters:
-
sessionId
GETID of the session to route the command to
getAttribute
-
sessionId
-
elementId
-
attr
Get the value of an element's attribute.
Parameters:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID of the element to route the command to
-
attr
GETAttribute that should be fetched
getCookie
-
sessionId
-
name
Retrieve a cookies by its name.
Parameters:
-
sessionId
GETID of the session to route the command to
-
name
GETName of the cookie
getCookies
-
sessionId
Retrieve all cookies visible to the current page.
Parameters:
-
sessionId
GETID of the session to route the command to
getLocalStorage
-
sessionId
Get all keys of the browsers local storage
Parameters:
-
sessionId
GETID of the session to route the command to
getLocalStorageSize
-
sessionId
Get the number of items in the storage
Parameters:
-
sessionId
GETID of the session to route the command to
getSessionStorage
-
sessionId
Get all keys of the browsers session storage
Parameters:
-
sessionId
GETID of the session to route the command to
getSessionStorageEntry
-
sessionId
-
key
Get the storage item for the given key
Parameters:
-
sessionId
GETID of the session to route the command to
-
key
GETThe key to get
getSessionStorageSize
-
sessionId
Get the number of items in the storage
Parameters:
-
sessionId
GETID of the session to route the command to
getUrl
-
sessionId
Retrieve the URL of the current page
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
windowHandle
GETID 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:
-
sessionId
GETID of the session to route the command to
-
windowHandle
GETID 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:
-
sessionId
GETID of the session to route the command to
-
ms
POSTThe 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:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID 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:
-
sessionId
GETID of the session to route the command to
logTypes
-
sessionId
Get available log types
Parameters:
-
sessionId
GETID of the session to route the command to
longpress
-
sessionId
Long press on the touch screen using finger motion events.
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
element
POSTOpaque 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.
-
xoffset
POSTX 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.
-
yoffset
POSTY 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:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID of the element to route the command to
orientation
-
sessionId
Checks the device orientation
Parameters:
-
sessionId
GETID of the session to route the command to
parseUrl
-
url
-
options
Parses an JSON Wire protocol dummy url
Parameters:
-
url
StringURL with placeholders
-
options
ObjectList of url options
Returns:
url Parsed URL
promptText
-
sessionId
-
text
Sets a prompt text
Parameters:
-
sessionId
GETID of the session to route the command to
-
text
POSTText to set
refresh
-
sessionId
Refresh the current page
Parameters:
-
sessionId
GETID of the session to route the command to
screenshot
-
sessionId
Take a screenshot of the current page.
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
id
GETID of the element to route the command to
-
text
POSTThe keys sequence to be sent
session
-
sessionId
Retrieve the capabilities of the specified session.
Parameters:
-
sessionId
GETID of the session to route the command to
session
-
sessionId
Delete the session.
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
cookie
POSTThe cookie object
setGeoLocation
-
sessionId
-
latitude
-
longitude
-
altitude
Set the geo location
Parameters:
-
sessionId
GETID of the session to route the command to
-
latitude
POSTThe new location
-
longitude
POSTThe new location
-
altitude
POSTThe new location
setLocalStorage
-
sessionId
-
key
-
value
Set the storage item for the given key
Parameters:
-
sessionId
GETID of the session to route the command to
-
key
POSTThe key to set
-
value
POSTThe value to set
setWindowPosition
-
sessionId
-
x
-
y
Set the position of the specified window.
Parameters:
-
sessionId
POSTID of the session to route the command to
-
x
POSTThe X coordinates for the window, relative to the upper left corner of the screen.
-
y
POSTThe 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:
-
sessionId
POSTID of the session to route the command to
-
windowHandle
POSTID of the window to route the command to
-
width
POSTThe new window width
-
height
POSTThe 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:
-
sessionId
GETID of the session to route the command to
-
elementId
GETID of the element to route the command to
source
-
sessionId
Get the current page source
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
id
GETID of the element to route the command to
tap
-
sessionId
Single tap on the touch enabled device.
Parameters:
-
sessionId
GETID of the session to route the command to
text
-
sessionId
-
id
Returns the visible text for the element.
Parameters:
-
sessionId
GETID of the session to route the command to
-
id
GETID 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:
-
sessionId
GETID of the session to route the command to
-
type
POSTThe 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
-
ms
POSTThe amount of time to wait, in milliseconds. This value has a lower bound of 0
title
-
sessionId
Get the current page title
Parameters:
-
sessionId
GETID of the session to route the command to
touchdown
-
sessionId
-
x
-
y
Finger down on the screen.
Parameters:
-
sessionId
GETID of the session to route the command to
-
x
POSTX coordinate on the screen.
-
y
POSTY coordinate on the screen.
touchmove
-
sessionId
-
x
-
y
Finger move on the screen.
Parameters:
-
sessionId
GETID of the session to route the command to
-
x
POSTX coordinate on the screen.
-
y
POSTY 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:
-
sessionId
GETID of the session to route the command to
-
x
POSTX coordinate on the screen.
-
y
POSTY coordinate on the screen.
touchup
-
sessionId
-
x
-
y
Finger up on the screen.
Parameters:
-
sessionId
GETID of the session to route the command to
-
x
POSTX coordinate on the screen.
-
y
POSTY coordinate on the screen.
url
-
sessionId
-
page
Navigate to a new URL
Parameters:
-
sessionId
GETID of the session to route the command to
-
page
POSTThe URL to navigate to.
val
-
sessionId
-
id
-
text
Send a sequence of key strokes to an element
Parameters:
-
sessionId
GETID of the session to route the command to
-
id
GETID of the element to route the command to
-
text
POSTThe keys sequence to be sent
windowHandle
-
sessionId
Retrieve the current window handle.
Parameters:
-
sessionId
GETID of the session to route the command to
windowHandles
-
sessionId
Retrieve the list of all window handles available to the session.
Parameters:
-
sessionId
GETID 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:
-
sessionId
GETID of the session to route the command to
-
windowHandle
GETID of the window to route the command to