Class: Selenium

Selenium

Members

distinctTimestamps

Anonymous object (serving as an associative array) { string timestampName: anonymous object { precision: number, the smallest unit of time displayed on the screen for respective timestamp elements nextDistinctTimestamp: number, a nearest future timestamp (in milliseconds) (that is, a value returned by Date.now() at that moment) when this timestampName can have a new distinct timestamp, which can be distinguished from the last one (and any older ones) using the given precision } where timestampName is a label/name, usually of a timestamp element or field (DB column), or of a whole fieldset (DB table) if it has only one timestamp field (column).
Source:

doTypeRobust :function

Type:
  • function
Source:
To Do:
  • eliminate? Or, keep, if we use NaN

evalWithExpandedStoredVars :function

SelBlocksGlobal: This is used instead of SelBlocks' evalWithVars(expr)
Type:
  • function
Source:

randomTopDomainsShort

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

Methods

(static) download({string) → {Promise}

Start downloading a file.
Parameters:
Name Type Description
{string url Full URL.
Source:
Returns:
As per https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm#fetch%28%29.
Type
Promise

(static) encodeContent(content) → {Promise}

Parameters:
Name Type Description
content string | ArrayBuffer
Source:
Returns:
Promise that resolved to encoded content; it rejects on error or on timeout.
Type
Promise

(static) recentWindow()

This allows to access .gBrowser. Other ways failed: window.gBrowser, selenium.browserbot.getCurrentWindow().gBrowser, window.opener.gBrowser.
Source:

(static) seLiteAfterCurrentCommand()

This will be appended after standard _executeCurrentCommand() through a tail override.
Source:

(static) seLiteBeforeCurrentCommand()

This will be inserted before standard _executeCurrentCommand() through a head override.
Source:

actionForIteratorObject(varName, extraValidationAndIterator)

Parameters:
Name Type Description
varName string
extraValidationAndIterator function Extra validation to run. No parameters. It must return an iterator object (not iterable, neither GeneratorFunction).
Source:

callBackInFlow(seleneseFunctionName, seleneseParameters)

'Synchronous' - i.e. for Javascript that is invoked from a Selenese script that is already running (via getEval or via custom Selenese command). It runs SelBlocks Global 'call' command for given Selenese function *after* the current Selenese command (i.e. getVal or custom Selenese command) finishes.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
To Do:
  • test stored var _result

callBackOutFlow(seleneseFunctionName, seleneseParameters) → {Promise}

'Asynchronous'- i.e. for Javascript invoked through e.g. SeLite Preview after a Selenese run finished.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
Returns:
A Promise object that will receive a Selenese return value on success, or an exception on failure. (It will be called after the Selenese run flow finished - i.e. through window.setTimeout().)
Type
Promise

callStack()

Solely for selenium-executionloop-handleAsTryBlock.js.
Source:

cascadeElseIf() → {undefined|function}

Source:
Returns:
Return a function exactly when withPromise==true. Otherwise return undefined.
Type
undefined | function

doCall(funcName, argSpec, invokedFromJavascriptopt, onSuccessopt, onFailureopt)

Note: See also ThirdPartyIssues.md > https://github.com/SeleniumHQ/selenium/issues/1635 If callFromAsync, then either onSuccess or onFailure will be called on success or failure, respectively. It will be invoked asynchronously, *after* returning back to Javascript caller (i.e. to a non-Selenese layer that invoked this doCall()).
Parameters:
Name Type Attributes Default Description
funcName string
argSpec string | object Comma-separated assignments of Selenese function parameters. Or an object (easily passed within =<>...<> as per http://selite.github.io/EnhancedSelenese) - then its fields define the Selenese function parameters. See reference.xml.
invokedFromJavascript boolean <optional>
false Whether invoked from Javascript (rather than directly from Selenese)
onSuccess function <optional>
Callback function. Only used if invokedFromJavascript==true.
onFailure function <optional>
Callback function. Only used if invokedFromJavascript==true.
Source:

doInsertRecord(recordObject, table)

Parameters:
Name Type Description
recordObject object
table SeLiteData.Table
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:
Example
setImplicitWait | 0
     setImplicitWait | 1000

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:
Example
setImplicitWaitCondition |  0  |  
     setImplicitWaitCondition |  1000  | !window.Sys || !window.Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
     setImplicitWaitCondition |  1000  | !window.dojo || !window.dojo.io.XMLHTTPTransport.inFlight.length;
     setImplicitWaitCondition |  1000  | !window.Ajax || !window.Ajax.activeRequestCount;
     setImplicitWaitCondition |  1000  | !window.tapestry || !window.tapestry.isServingRequests();
     setImplicitWaitCondition |  1000  | !window.jQuery || !window.jQuery.active;

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:

doSleepUntilTimestampDistinctDownToMilliseconds()

This and similar functions have name starting with 'doSleepUntil'. That way when you type 'waitForDistinctTimestamp' in Selenium IDE, it doesn't auto-suggest '...AndWait' alternatives, which we don't want and which would confuse user. If the function name was any doXyz that doesn't start with 'doSleepUntil', Selenium IDE would auto-suggest '..AndWait' alternative, which don't make sense.
Source:

encodeFile(filePathOrURL, useURLencodingopt, contentHandleropt) → {Promise}

Encode a file as a data: URI. See https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs. It also loads content of files referenced by <img src="...">, <link href="..." with rel="stylesheet" or with as="script" or with type="...">, <script src="...">. It changes src="..." or href="..." of those elements to use data: containing the loaded content.
Parameters:
Name Type Attributes Default Description
filePathOrURL string File path or URL of the HTML/XML preview file/template. It must be a full URL (including the scheme/protocol), or a full path. If it's a file path, you can use either / or \ as directory separators (they will get translated for the current system). To make it portable, specify it as a relative path and pass it appended to result of SeLiteSettings.getTestSuiteFolder(). It must not be a data: URL. It must not contain a #hash/fragment part.
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
udefined Whether to apply base 64 encoding (human-unreadable) rather than URL encoding (English text is human-readable). Thri-state parameter: -If true, then this always uses URL encoding (the result may not work with decodeURIComponent()). -If undefined, then it's automatic: URL encoding for text files (whose MIME starts with "text/" and for .xhtml files) and base 64 for the rest. -If false, then this always uses base 64 encoding. -If a string, an array, a regex: matching MIME prefix for files to URL encode, in addition to the above automatic rule. -If a function, then useURLencoding(mimeString) determines whether to use URL encoding, in addition to the above automatic rule.
contentHandler function <optional>
Function(content) => Promise of a string (the handled content). Used for deep/recursive handling. Parameter url is used only for resolving relative URLs for documents that are handled recursively.
Source:
See:
  • Editor.prototype.openPreview()
Returns:
Promise that resolves to encoded content (and handled, if contentHandler is passed); it rejects on error or on timeout. On success it resolves to string, which is a data: URI for content of given documentURL, including content of images/scripts/stylesheets through data: URIs, too.
Type
Promise

encodeFileRecursiveHandler(filter)

Parameters:
Name Type Description
filter string | array | RegExp | function | undefined See Selenium.prototype.encodeFileRecursively().
Source:

encodeFileWithHandler(filePathOrURL, useURLencodingopt, fetchFilter, handleropt) → {Promise}

Parameters:
Name Type Attributes Description
filePathOrURL string See Selenium.prototype.encodeFile().
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
See Selenium.prototype.encodeFile().
fetchFilter string | array | RegExp | function | undefined Filter that determines for a given URL whether to fetch it or not. - String application webroot. Any resources under it, even if referenced through full URLs, will be fetched. - Array of webroots. Any resources under them will be fetched. - RegExp matching any URLs to fetch. - Function(url) that returns whether to fetch a URL. - undefined to fetch any URLs on the same server (or under same top folder/Windows volume).
handler function <optional>
Function (fetchFilter, useURLencoding, contentURL, content) => Promise.
Source:
Returns:
Promise of a string content.
Type
Promise

getReadRecord(info) → {object}

This is not called getRecord, because then autogenerated storeRecord would be confusing/counter-intuitive: it could imply that it's storing something in the DB, while it would be retrieving a record from the DB and storing it in a stored variable.
Parameters:
Name Type Description
info object
Source:
Returns:
Type
object

handlePotentialPromise(promiseOrResult, handleropt, withPromiseopt) → {function|undefined}

This functions streamlines handling of Promise (or potentially Promise) results in Selenese commands. Call it from Selenium.prototype.doYourFunction(first, second) and return its result value. That ensures the mechanism works for promiseOrResult being either a Promise or a non-Promise.
Parameters:
Name Type Attributes Default Description
promiseOrResult * | Promise
handler function <optional>
A callback function. If present, this will invoke it either - immediately if !withPromise, or - once the promise resolved (which can also be immediately), but not if it resolved after timing out
withPromise boolean <optional>
false Whether promiseOrResult should be a Promise, or not. This function validated promiseOrResult accordingly..
Source:
Returns:
Exactly if withPromise, then return a function to return back to Selenium (that will be used as continuation test) that checks the promise status of and promiseOrResult and it throws on timeout. Otherwise (i.e. !withPromise) return undefined (i.e. no need for a continuation test).
Type
function | undefined

loadFile(url, binaryopt) → {Promise}

Load a given file asynchronously.
Parameters:
Name Type Attributes Default Description
url string URL of the file. It must be a full URL (including the scheme/protocol).
binary boolean <optional>
false Whether it's a binary file. If unsure, pass true.
Source:
Returns:
A Promise that will resolve to content of the file: either to a string (if binary is not set/false), or to an ArrayBuffer (if binary is true). On failure or timeout it will be rejected.
Type
Promise

noteTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command. Use to record the moment when you inserted/updated a record of given type, and you want to compare that record's timestamp (whether soon or later) as formatted on the webpage (using given precision).

Warning: This keeps a count only of timestamps notes since you started Selenium IDE. If you re-started it soon after the previous run(s) which could record timestamps, make sure you wait for a sufficient period to get distinct new timestamps.
Parameters:
Name Type Description
string timestampName Type/use case group of the record that you're upgrading/inserting. Records that can be compared between each other should have same timestampName. Then this assures that they get timestamps that show up as distinct. Records with different timestampName can get same timestamps, because they are not supposed to be compared to each other.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds
Source:

preprocessParameter()

A head intercept of preprocessParameter() from chrome/content/selenium-core/scripts/selenium-api.js. It implements http://selite.github.io/EnhancedSelenese.
Source:

randomOption(string, paramsopt)

This returns a random option from within identified by a given locator. I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Attributes Default Description
string selectLocator Locator of the . It has to be an XPath-based locator, without 'xpath=' at the front.
params Object.<string, boolean> <optional>
{} Optional, an object in form { excludeFirst: true, // Whether to exclude the first option excludeLast: true, // Whether to exclude the last option }
Source:
Returns:
DOM Element of a random from within the select

randomText()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter. Return a random text, restricted by params, and fit for an input element identified by locator. It always returns at least 1 character.
Source:
Returns:
string as speficied in doTypeRandom()

setJavascriptPref()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

timestampComparesTo(string, number, number, bool)

Internal function, used to compare a displayed human-readable timestamp to a numeric timestamp, allowing for difference of maxTimeDifference() (milllisec) and this.defaultTimeout (ms) and 1x display time unit (displayPrecisionInSeconds). I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Description
string locator Selenium locator of the element that contains the displayed human-readable (and parsable) time stamp
number timestampInMilliseconds Expected timestamp, number of milliseconds since Epoch
number displayPrecisionInMilliseconds Smallest displayed time unit, in milliseconds
bool validatePrecision
Source:
To Do:
  • Use parameter timezone. Allow both short and long names? Make it daylightsaving-friendly, so that the test can run when daylightsaving changes - don't cache the time shift. This doesn't use timezone support in Date.parse(), because that only understands GMT, Z and US time zone abbreviations - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse and try Date.parse( "Fri, 11 Oct 2013 05:55:00 AEST" ) - it evaluates to NaN. evaluate in a .js file or via Firebug console, not via 'javascript:' url: new Intl.DateTimeFormat("en-GB", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/supportedLocalesOf This is on hold, pending https://bugzilla.mozilla.org/show_bug.cgi?id=837961. In Firefox 47.0a1 timezones seem to work one way only: new Intl.DateTimeFormat('en-AU', {timeZoneName: 'short'}).format( new Date() ) -> "12/02/2016, AEDT" new Intl.DateTimeFormat("en-AU", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) -> RangeError: invalid time zone new Intl.DateTimeFormat('en-AU', {timeZoneName: 'long'}).format( new Date() ) -> "12/02/2016, Australian Eastern Daylight Time" new Intl.DateTimeFormat("en-AU", {timeZone:"Australian Eastern Daylight Time", timeZoneName:'long'}).format( new Date()) -> RangeError: invalid time zone

waitForDistinctTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command.
Parameters:
Name Type Description
string timestampName label/name, usually of a timestamp element or field, for which you want to get a distinct timestamp.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds.
Source:
Returns:
true if it's safe to create a new timestamp for this type of record, and the timestamp will be distinguishable from the previous one.

Selenium

Members

distinctTimestamps

Anonymous object (serving as an associative array) { string timestampName: anonymous object { precision: number, the smallest unit of time displayed on the screen for respective timestamp elements nextDistinctTimestamp: number, a nearest future timestamp (in milliseconds) (that is, a value returned by Date.now() at that moment) when this timestampName can have a new distinct timestamp, which can be distinguished from the last one (and any older ones) using the given precision } where timestampName is a label/name, usually of a timestamp element or field (DB column), or of a whole fieldset (DB table) if it has only one timestamp field (column).
Source:

doTypeRobust :function

Type:
  • function
Source:
To Do:
  • eliminate? Or, keep, if we use NaN

evalWithExpandedStoredVars :function

SelBlocksGlobal: This is used instead of SelBlocks' evalWithVars(expr)
Type:
  • function
Source:

randomTopDomainsShort

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

Methods

(static) download({string) → {Promise}

Start downloading a file.
Parameters:
Name Type Description
{string url Full URL.
Source:
Returns:
As per https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm#fetch%28%29.
Type
Promise

(static) encodeContent(content) → {Promise}

Parameters:
Name Type Description
content string | ArrayBuffer
Source:
Returns:
Promise that resolved to encoded content; it rejects on error or on timeout.
Type
Promise

(static) recentWindow()

This allows to access .gBrowser. Other ways failed: window.gBrowser, selenium.browserbot.getCurrentWindow().gBrowser, window.opener.gBrowser.
Source:

(static) seLiteAfterCurrentCommand()

This will be appended after standard _executeCurrentCommand() through a tail override.
Source:

(static) seLiteBeforeCurrentCommand()

This will be inserted before standard _executeCurrentCommand() through a head override.
Source:

actionForIteratorObject(varName, extraValidationAndIterator)

Parameters:
Name Type Description
varName string
extraValidationAndIterator function Extra validation to run. No parameters. It must return an iterator object (not iterable, neither GeneratorFunction).
Source:

callBackInFlow(seleneseFunctionName, seleneseParameters)

'Synchronous' - i.e. for Javascript that is invoked from a Selenese script that is already running (via getEval or via custom Selenese command). It runs SelBlocks Global 'call' command for given Selenese function *after* the current Selenese command (i.e. getVal or custom Selenese command) finishes.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
To Do:
  • test stored var _result

callBackOutFlow(seleneseFunctionName, seleneseParameters) → {Promise}

'Asynchronous'- i.e. for Javascript invoked through e.g. SeLite Preview after a Selenese run finished.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
Returns:
A Promise object that will receive a Selenese return value on success, or an exception on failure. (It will be called after the Selenese run flow finished - i.e. through window.setTimeout().)
Type
Promise

callStack()

Solely for selenium-executionloop-handleAsTryBlock.js.
Source:

cascadeElseIf() → {undefined|function}

Source:
Returns:
Return a function exactly when withPromise==true. Otherwise return undefined.
Type
undefined | function

doCall(funcName, argSpec, invokedFromJavascriptopt, onSuccessopt, onFailureopt)

Note: See also ThirdPartyIssues.md > https://github.com/SeleniumHQ/selenium/issues/1635 If callFromAsync, then either onSuccess or onFailure will be called on success or failure, respectively. It will be invoked asynchronously, *after* returning back to Javascript caller (i.e. to a non-Selenese layer that invoked this doCall()).
Parameters:
Name Type Attributes Default Description
funcName string
argSpec string | object Comma-separated assignments of Selenese function parameters. Or an object (easily passed within =<>...<> as per http://selite.github.io/EnhancedSelenese) - then its fields define the Selenese function parameters. See reference.xml.
invokedFromJavascript boolean <optional>
false Whether invoked from Javascript (rather than directly from Selenese)
onSuccess function <optional>
Callback function. Only used if invokedFromJavascript==true.
onFailure function <optional>
Callback function. Only used if invokedFromJavascript==true.
Source:

doInsertRecord(recordObject, table)

Parameters:
Name Type Description
recordObject object
table SeLiteData.Table
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:
Example
setImplicitWait | 0
     setImplicitWait | 1000

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:
Example
setImplicitWaitCondition |  0  |  
     setImplicitWaitCondition |  1000  | !window.Sys || !window.Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
     setImplicitWaitCondition |  1000  | !window.dojo || !window.dojo.io.XMLHTTPTransport.inFlight.length;
     setImplicitWaitCondition |  1000  | !window.Ajax || !window.Ajax.activeRequestCount;
     setImplicitWaitCondition |  1000  | !window.tapestry || !window.tapestry.isServingRequests();
     setImplicitWaitCondition |  1000  | !window.jQuery || !window.jQuery.active;

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:

doSleepUntilTimestampDistinctDownToMilliseconds()

This and similar functions have name starting with 'doSleepUntil'. That way when you type 'waitForDistinctTimestamp' in Selenium IDE, it doesn't auto-suggest '...AndWait' alternatives, which we don't want and which would confuse user. If the function name was any doXyz that doesn't start with 'doSleepUntil', Selenium IDE would auto-suggest '..AndWait' alternative, which don't make sense.
Source:

encodeFile(filePathOrURL, useURLencodingopt, contentHandleropt) → {Promise}

Encode a file as a data: URI. See https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs. It also loads content of files referenced by <img src="...">, <link href="..." with rel="stylesheet" or with as="script" or with type="...">, <script src="...">. It changes src="..." or href="..." of those elements to use data: containing the loaded content.
Parameters:
Name Type Attributes Default Description
filePathOrURL string File path or URL of the HTML/XML preview file/template. It must be a full URL (including the scheme/protocol), or a full path. If it's a file path, you can use either / or \ as directory separators (they will get translated for the current system). To make it portable, specify it as a relative path and pass it appended to result of SeLiteSettings.getTestSuiteFolder(). It must not be a data: URL. It must not contain a #hash/fragment part.
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
udefined Whether to apply base 64 encoding (human-unreadable) rather than URL encoding (English text is human-readable). Thri-state parameter: -If true, then this always uses URL encoding (the result may not work with decodeURIComponent()). -If undefined, then it's automatic: URL encoding for text files (whose MIME starts with "text/" and for .xhtml files) and base 64 for the rest. -If false, then this always uses base 64 encoding. -If a string, an array, a regex: matching MIME prefix for files to URL encode, in addition to the above automatic rule. -If a function, then useURLencoding(mimeString) determines whether to use URL encoding, in addition to the above automatic rule.
contentHandler function <optional>
Function(content) => Promise of a string (the handled content). Used for deep/recursive handling. Parameter url is used only for resolving relative URLs for documents that are handled recursively.
Source:
See:
  • Editor.prototype.openPreview()
Returns:
Promise that resolves to encoded content (and handled, if contentHandler is passed); it rejects on error or on timeout. On success it resolves to string, which is a data: URI for content of given documentURL, including content of images/scripts/stylesheets through data: URIs, too.
Type
Promise

encodeFileRecursiveHandler(filter)

Parameters:
Name Type Description
filter string | array | RegExp | function | undefined See Selenium.prototype.encodeFileRecursively().
Source:

encodeFileWithHandler(filePathOrURL, useURLencodingopt, fetchFilter, handleropt) → {Promise}

Parameters:
Name Type Attributes Description
filePathOrURL string See Selenium.prototype.encodeFile().
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
See Selenium.prototype.encodeFile().
fetchFilter string | array | RegExp | function | undefined Filter that determines for a given URL whether to fetch it or not. - String application webroot. Any resources under it, even if referenced through full URLs, will be fetched. - Array of webroots. Any resources under them will be fetched. - RegExp matching any URLs to fetch. - Function(url) that returns whether to fetch a URL. - undefined to fetch any URLs on the same server (or under same top folder/Windows volume).
handler function <optional>
Function (fetchFilter, useURLencoding, contentURL, content) => Promise.
Source:
Returns:
Promise of a string content.
Type
Promise

getReadRecord(info) → {object}

This is not called getRecord, because then autogenerated storeRecord would be confusing/counter-intuitive: it could imply that it's storing something in the DB, while it would be retrieving a record from the DB and storing it in a stored variable.
Parameters:
Name Type Description
info object
Source:
Returns:
Type
object

handlePotentialPromise(promiseOrResult, handleropt, withPromiseopt) → {function|undefined}

This functions streamlines handling of Promise (or potentially Promise) results in Selenese commands. Call it from Selenium.prototype.doYourFunction(first, second) and return its result value. That ensures the mechanism works for promiseOrResult being either a Promise or a non-Promise.
Parameters:
Name Type Attributes Default Description
promiseOrResult * | Promise
handler function <optional>
A callback function. If present, this will invoke it either - immediately if !withPromise, or - once the promise resolved (which can also be immediately), but not if it resolved after timing out
withPromise boolean <optional>
false Whether promiseOrResult should be a Promise, or not. This function validated promiseOrResult accordingly..
Source:
Returns:
Exactly if withPromise, then return a function to return back to Selenium (that will be used as continuation test) that checks the promise status of and promiseOrResult and it throws on timeout. Otherwise (i.e. !withPromise) return undefined (i.e. no need for a continuation test).
Type
function | undefined

loadFile(url, binaryopt) → {Promise}

Load a given file asynchronously.
Parameters:
Name Type Attributes Default Description
url string URL of the file. It must be a full URL (including the scheme/protocol).
binary boolean <optional>
false Whether it's a binary file. If unsure, pass true.
Source:
Returns:
A Promise that will resolve to content of the file: either to a string (if binary is not set/false), or to an ArrayBuffer (if binary is true). On failure or timeout it will be rejected.
Type
Promise

noteTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command. Use to record the moment when you inserted/updated a record of given type, and you want to compare that record's timestamp (whether soon or later) as formatted on the webpage (using given precision).

Warning: This keeps a count only of timestamps notes since you started Selenium IDE. If you re-started it soon after the previous run(s) which could record timestamps, make sure you wait for a sufficient period to get distinct new timestamps.
Parameters:
Name Type Description
string timestampName Type/use case group of the record that you're upgrading/inserting. Records that can be compared between each other should have same timestampName. Then this assures that they get timestamps that show up as distinct. Records with different timestampName can get same timestamps, because they are not supposed to be compared to each other.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds
Source:

preprocessParameter()

A head intercept of preprocessParameter() from chrome/content/selenium-core/scripts/selenium-api.js. It implements http://selite.github.io/EnhancedSelenese.
Source:

randomOption(string, paramsopt)

This returns a random option from within identified by a given locator. I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Attributes Default Description
string selectLocator Locator of the . It has to be an XPath-based locator, without 'xpath=' at the front.
params Object.<string, boolean> <optional>
{} Optional, an object in form { excludeFirst: true, // Whether to exclude the first option excludeLast: true, // Whether to exclude the last option }
Source:
Returns:
DOM Element of a random from within the select

randomText()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter. Return a random text, restricted by params, and fit for an input element identified by locator. It always returns at least 1 character.
Source:
Returns:
string as speficied in doTypeRandom()

setJavascriptPref()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

timestampComparesTo(string, number, number, bool)

Internal function, used to compare a displayed human-readable timestamp to a numeric timestamp, allowing for difference of maxTimeDifference() (milllisec) and this.defaultTimeout (ms) and 1x display time unit (displayPrecisionInSeconds). I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Description
string locator Selenium locator of the element that contains the displayed human-readable (and parsable) time stamp
number timestampInMilliseconds Expected timestamp, number of milliseconds since Epoch
number displayPrecisionInMilliseconds Smallest displayed time unit, in milliseconds
bool validatePrecision
Source:
To Do:
  • Use parameter timezone. Allow both short and long names? Make it daylightsaving-friendly, so that the test can run when daylightsaving changes - don't cache the time shift. This doesn't use timezone support in Date.parse(), because that only understands GMT, Z and US time zone abbreviations - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse and try Date.parse( "Fri, 11 Oct 2013 05:55:00 AEST" ) - it evaluates to NaN. evaluate in a .js file or via Firebug console, not via 'javascript:' url: new Intl.DateTimeFormat("en-GB", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/supportedLocalesOf This is on hold, pending https://bugzilla.mozilla.org/show_bug.cgi?id=837961. In Firefox 47.0a1 timezones seem to work one way only: new Intl.DateTimeFormat('en-AU', {timeZoneName: 'short'}).format( new Date() ) -> "12/02/2016, AEDT" new Intl.DateTimeFormat("en-AU", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) -> RangeError: invalid time zone new Intl.DateTimeFormat('en-AU', {timeZoneName: 'long'}).format( new Date() ) -> "12/02/2016, Australian Eastern Daylight Time" new Intl.DateTimeFormat("en-AU", {timeZone:"Australian Eastern Daylight Time", timeZoneName:'long'}).format( new Date()) -> RangeError: invalid time zone

waitForDistinctTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command.
Parameters:
Name Type Description
string timestampName label/name, usually of a timestamp element or field, for which you want to get a distinct timestamp.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds.
Source:
Returns:
true if it's safe to create a new timestamp for this type of record, and the timestamp will be distinguishable from the previous one.

Selenium

Members

distinctTimestamps

Anonymous object (serving as an associative array) { string timestampName: anonymous object { precision: number, the smallest unit of time displayed on the screen for respective timestamp elements nextDistinctTimestamp: number, a nearest future timestamp (in milliseconds) (that is, a value returned by Date.now() at that moment) when this timestampName can have a new distinct timestamp, which can be distinguished from the last one (and any older ones) using the given precision } where timestampName is a label/name, usually of a timestamp element or field (DB column), or of a whole fieldset (DB table) if it has only one timestamp field (column).
Source:

doTypeRobust :function

Type:
  • function
Source:
To Do:
  • eliminate? Or, keep, if we use NaN

evalWithExpandedStoredVars :function

SelBlocksGlobal: This is used instead of SelBlocks' evalWithVars(expr)
Type:
  • function
Source:

randomTopDomainsShort

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

Methods

(static) download({string) → {Promise}

Start downloading a file.
Parameters:
Name Type Description
{string url Full URL.
Source:
Returns:
As per https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm#fetch%28%29.
Type
Promise

(static) encodeContent(content) → {Promise}

Parameters:
Name Type Description
content string | ArrayBuffer
Source:
Returns:
Promise that resolved to encoded content; it rejects on error or on timeout.
Type
Promise

(static) recentWindow()

This allows to access .gBrowser. Other ways failed: window.gBrowser, selenium.browserbot.getCurrentWindow().gBrowser, window.opener.gBrowser.
Source:

(static) seLiteAfterCurrentCommand()

This will be appended after standard _executeCurrentCommand() through a tail override.
Source:

(static) seLiteBeforeCurrentCommand()

This will be inserted before standard _executeCurrentCommand() through a head override.
Source:

actionForIteratorObject(varName, extraValidationAndIterator)

Parameters:
Name Type Description
varName string
extraValidationAndIterator function Extra validation to run. No parameters. It must return an iterator object (not iterable, neither GeneratorFunction).
Source:

callBackInFlow(seleneseFunctionName, seleneseParameters)

'Synchronous' - i.e. for Javascript that is invoked from a Selenese script that is already running (via getEval or via custom Selenese command). It runs SelBlocks Global 'call' command for given Selenese function *after* the current Selenese command (i.e. getVal or custom Selenese command) finishes.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
To Do:
  • test stored var _result

callBackOutFlow(seleneseFunctionName, seleneseParameters) → {Promise}

'Asynchronous'- i.e. for Javascript invoked through e.g. SeLite Preview after a Selenese run finished.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
Returns:
A Promise object that will receive a Selenese return value on success, or an exception on failure. (It will be called after the Selenese run flow finished - i.e. through window.setTimeout().)
Type
Promise

callStack()

Solely for selenium-executionloop-handleAsTryBlock.js.
Source:

cascadeElseIf() → {undefined|function}

Source:
Returns:
Return a function exactly when withPromise==true. Otherwise return undefined.
Type
undefined | function

doCall(funcName, argSpec, invokedFromJavascriptopt, onSuccessopt, onFailureopt)

Note: See also ThirdPartyIssues.md > https://github.com/SeleniumHQ/selenium/issues/1635 If callFromAsync, then either onSuccess or onFailure will be called on success or failure, respectively. It will be invoked asynchronously, *after* returning back to Javascript caller (i.e. to a non-Selenese layer that invoked this doCall()).
Parameters:
Name Type Attributes Default Description
funcName string
argSpec string | object Comma-separated assignments of Selenese function parameters. Or an object (easily passed within =<>...<> as per http://selite.github.io/EnhancedSelenese) - then its fields define the Selenese function parameters. See reference.xml.
invokedFromJavascript boolean <optional>
false Whether invoked from Javascript (rather than directly from Selenese)
onSuccess function <optional>
Callback function. Only used if invokedFromJavascript==true.
onFailure function <optional>
Callback function. Only used if invokedFromJavascript==true.
Source:

doInsertRecord(recordObject, table)

Parameters:
Name Type Description
recordObject object
table SeLiteData.Table
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:
Example
setImplicitWait | 0
     setImplicitWait | 1000

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:
Example
setImplicitWaitCondition |  0  |  
     setImplicitWaitCondition |  1000  | !window.Sys || !window.Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
     setImplicitWaitCondition |  1000  | !window.dojo || !window.dojo.io.XMLHTTPTransport.inFlight.length;
     setImplicitWaitCondition |  1000  | !window.Ajax || !window.Ajax.activeRequestCount;
     setImplicitWaitCondition |  1000  | !window.tapestry || !window.tapestry.isServingRequests();
     setImplicitWaitCondition |  1000  | !window.jQuery || !window.jQuery.active;

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:

doSleepUntilTimestampDistinctDownToMilliseconds()

This and similar functions have name starting with 'doSleepUntil'. That way when you type 'waitForDistinctTimestamp' in Selenium IDE, it doesn't auto-suggest '...AndWait' alternatives, which we don't want and which would confuse user. If the function name was any doXyz that doesn't start with 'doSleepUntil', Selenium IDE would auto-suggest '..AndWait' alternative, which don't make sense.
Source:

encodeFile(filePathOrURL, useURLencodingopt, contentHandleropt) → {Promise}

Encode a file as a data: URI. See https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs. It also loads content of files referenced by <img src="...">, <link href="..." with rel="stylesheet" or with as="script" or with type="...">, <script src="...">. It changes src="..." or href="..." of those elements to use data: containing the loaded content.
Parameters:
Name Type Attributes Default Description
filePathOrURL string File path or URL of the HTML/XML preview file/template. It must be a full URL (including the scheme/protocol), or a full path. If it's a file path, you can use either / or \ as directory separators (they will get translated for the current system). To make it portable, specify it as a relative path and pass it appended to result of SeLiteSettings.getTestSuiteFolder(). It must not be a data: URL. It must not contain a #hash/fragment part.
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
udefined Whether to apply base 64 encoding (human-unreadable) rather than URL encoding (English text is human-readable). Thri-state parameter: -If true, then this always uses URL encoding (the result may not work with decodeURIComponent()). -If undefined, then it's automatic: URL encoding for text files (whose MIME starts with "text/" and for .xhtml files) and base 64 for the rest. -If false, then this always uses base 64 encoding. -If a string, an array, a regex: matching MIME prefix for files to URL encode, in addition to the above automatic rule. -If a function, then useURLencoding(mimeString) determines whether to use URL encoding, in addition to the above automatic rule.
contentHandler function <optional>
Function(content) => Promise of a string (the handled content). Used for deep/recursive handling. Parameter url is used only for resolving relative URLs for documents that are handled recursively.
Source:
See:
  • Editor.prototype.openPreview()
Returns:
Promise that resolves to encoded content (and handled, if contentHandler is passed); it rejects on error or on timeout. On success it resolves to string, which is a data: URI for content of given documentURL, including content of images/scripts/stylesheets through data: URIs, too.
Type
Promise

encodeFileRecursiveHandler(filter)

Parameters:
Name Type Description
filter string | array | RegExp | function | undefined See Selenium.prototype.encodeFileRecursively().
Source:

encodeFileWithHandler(filePathOrURL, useURLencodingopt, fetchFilter, handleropt) → {Promise}

Parameters:
Name Type Attributes Description
filePathOrURL string See Selenium.prototype.encodeFile().
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
See Selenium.prototype.encodeFile().
fetchFilter string | array | RegExp | function | undefined Filter that determines for a given URL whether to fetch it or not. - String application webroot. Any resources under it, even if referenced through full URLs, will be fetched. - Array of webroots. Any resources under them will be fetched. - RegExp matching any URLs to fetch. - Function(url) that returns whether to fetch a URL. - undefined to fetch any URLs on the same server (or under same top folder/Windows volume).
handler function <optional>
Function (fetchFilter, useURLencoding, contentURL, content) => Promise.
Source:
Returns:
Promise of a string content.
Type
Promise

getReadRecord(info) → {object}

This is not called getRecord, because then autogenerated storeRecord would be confusing/counter-intuitive: it could imply that it's storing something in the DB, while it would be retrieving a record from the DB and storing it in a stored variable.
Parameters:
Name Type Description
info object
Source:
Returns:
Type
object

handlePotentialPromise(promiseOrResult, handleropt, withPromiseopt) → {function|undefined}

This functions streamlines handling of Promise (or potentially Promise) results in Selenese commands. Call it from Selenium.prototype.doYourFunction(first, second) and return its result value. That ensures the mechanism works for promiseOrResult being either a Promise or a non-Promise.
Parameters:
Name Type Attributes Default Description
promiseOrResult * | Promise
handler function <optional>
A callback function. If present, this will invoke it either - immediately if !withPromise, or - once the promise resolved (which can also be immediately), but not if it resolved after timing out
withPromise boolean <optional>
false Whether promiseOrResult should be a Promise, or not. This function validated promiseOrResult accordingly..
Source:
Returns:
Exactly if withPromise, then return a function to return back to Selenium (that will be used as continuation test) that checks the promise status of and promiseOrResult and it throws on timeout. Otherwise (i.e. !withPromise) return undefined (i.e. no need for a continuation test).
Type
function | undefined

loadFile(url, binaryopt) → {Promise}

Load a given file asynchronously.
Parameters:
Name Type Attributes Default Description
url string URL of the file. It must be a full URL (including the scheme/protocol).
binary boolean <optional>
false Whether it's a binary file. If unsure, pass true.
Source:
Returns:
A Promise that will resolve to content of the file: either to a string (if binary is not set/false), or to an ArrayBuffer (if binary is true). On failure or timeout it will be rejected.
Type
Promise

noteTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command. Use to record the moment when you inserted/updated a record of given type, and you want to compare that record's timestamp (whether soon or later) as formatted on the webpage (using given precision).

Warning: This keeps a count only of timestamps notes since you started Selenium IDE. If you re-started it soon after the previous run(s) which could record timestamps, make sure you wait for a sufficient period to get distinct new timestamps.
Parameters:
Name Type Description
string timestampName Type/use case group of the record that you're upgrading/inserting. Records that can be compared between each other should have same timestampName. Then this assures that they get timestamps that show up as distinct. Records with different timestampName can get same timestamps, because they are not supposed to be compared to each other.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds
Source:

preprocessParameter()

A head intercept of preprocessParameter() from chrome/content/selenium-core/scripts/selenium-api.js. It implements http://selite.github.io/EnhancedSelenese.
Source:

randomOption(string, paramsopt)

This returns a random option from within identified by a given locator. I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Attributes Default Description
string selectLocator Locator of the . It has to be an XPath-based locator, without 'xpath=' at the front.
params Object.<string, boolean> <optional>
{} Optional, an object in form { excludeFirst: true, // Whether to exclude the first option excludeLast: true, // Whether to exclude the last option }
Source:
Returns:
DOM Element of a random from within the select

randomText()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter. Return a random text, restricted by params, and fit for an input element identified by locator. It always returns at least 1 character.
Source:
Returns:
string as speficied in doTypeRandom()

setJavascriptPref()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

timestampComparesTo(string, number, number, bool)

Internal function, used to compare a displayed human-readable timestamp to a numeric timestamp, allowing for difference of maxTimeDifference() (milllisec) and this.defaultTimeout (ms) and 1x display time unit (displayPrecisionInSeconds). I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Description
string locator Selenium locator of the element that contains the displayed human-readable (and parsable) time stamp
number timestampInMilliseconds Expected timestamp, number of milliseconds since Epoch
number displayPrecisionInMilliseconds Smallest displayed time unit, in milliseconds
bool validatePrecision
Source:
To Do:
  • Use parameter timezone. Allow both short and long names? Make it daylightsaving-friendly, so that the test can run when daylightsaving changes - don't cache the time shift. This doesn't use timezone support in Date.parse(), because that only understands GMT, Z and US time zone abbreviations - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse and try Date.parse( "Fri, 11 Oct 2013 05:55:00 AEST" ) - it evaluates to NaN. evaluate in a .js file or via Firebug console, not via 'javascript:' url: new Intl.DateTimeFormat("en-GB", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/supportedLocalesOf This is on hold, pending https://bugzilla.mozilla.org/show_bug.cgi?id=837961. In Firefox 47.0a1 timezones seem to work one way only: new Intl.DateTimeFormat('en-AU', {timeZoneName: 'short'}).format( new Date() ) -> "12/02/2016, AEDT" new Intl.DateTimeFormat("en-AU", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) -> RangeError: invalid time zone new Intl.DateTimeFormat('en-AU', {timeZoneName: 'long'}).format( new Date() ) -> "12/02/2016, Australian Eastern Daylight Time" new Intl.DateTimeFormat("en-AU", {timeZone:"Australian Eastern Daylight Time", timeZoneName:'long'}).format( new Date()) -> RangeError: invalid time zone

waitForDistinctTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command.
Parameters:
Name Type Description
string timestampName label/name, usually of a timestamp element or field, for which you want to get a distinct timestamp.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds.
Source:
Returns:
true if it's safe to create a new timestamp for this type of record, and the timestamp will be distinguishable from the previous one.

Selenium

Members

distinctTimestamps

Anonymous object (serving as an associative array) { string timestampName: anonymous object { precision: number, the smallest unit of time displayed on the screen for respective timestamp elements nextDistinctTimestamp: number, a nearest future timestamp (in milliseconds) (that is, a value returned by Date.now() at that moment) when this timestampName can have a new distinct timestamp, which can be distinguished from the last one (and any older ones) using the given precision } where timestampName is a label/name, usually of a timestamp element or field (DB column), or of a whole fieldset (DB table) if it has only one timestamp field (column).
Source:

doTypeRobust :function

Type:
  • function
Source:
To Do:
  • eliminate? Or, keep, if we use NaN

evalWithExpandedStoredVars :function

SelBlocksGlobal: This is used instead of SelBlocks' evalWithVars(expr)
Type:
  • function
Source:

randomTopDomainsShort

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

Methods

(static) download({string) → {Promise}

Start downloading a file.
Parameters:
Name Type Description
{string url Full URL.
Source:
Returns:
As per https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm#fetch%28%29.
Type
Promise

(static) encodeContent(content) → {Promise}

Parameters:
Name Type Description
content string | ArrayBuffer
Source:
Returns:
Promise that resolved to encoded content; it rejects on error or on timeout.
Type
Promise

(static) recentWindow()

This allows to access .gBrowser. Other ways failed: window.gBrowser, selenium.browserbot.getCurrentWindow().gBrowser, window.opener.gBrowser.
Source:

(static) seLiteAfterCurrentCommand()

This will be appended after standard _executeCurrentCommand() through a tail override.
Source:

(static) seLiteBeforeCurrentCommand()

This will be inserted before standard _executeCurrentCommand() through a head override.
Source:

actionForIteratorObject(varName, extraValidationAndIterator)

Parameters:
Name Type Description
varName string
extraValidationAndIterator function Extra validation to run. No parameters. It must return an iterator object (not iterable, neither GeneratorFunction).
Source:

callBackInFlow(seleneseFunctionName, seleneseParameters)

'Synchronous' - i.e. for Javascript that is invoked from a Selenese script that is already running (via getEval or via custom Selenese command). It runs SelBlocks Global 'call' command for given Selenese function *after* the current Selenese command (i.e. getVal or custom Selenese command) finishes.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
To Do:
  • test stored var _result

callBackOutFlow(seleneseFunctionName, seleneseParameters) → {Promise}

'Asynchronous'- i.e. for Javascript invoked through e.g. SeLite Preview after a Selenese run finished.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
Returns:
A Promise object that will receive a Selenese return value on success, or an exception on failure. (It will be called after the Selenese run flow finished - i.e. through window.setTimeout().)
Type
Promise

callStack()

Solely for selenium-executionloop-handleAsTryBlock.js.
Source:

cascadeElseIf() → {undefined|function}

Source:
Returns:
Return a function exactly when withPromise==true. Otherwise return undefined.
Type
undefined | function

doCall(funcName, argSpec, invokedFromJavascriptopt, onSuccessopt, onFailureopt)

Note: See also ThirdPartyIssues.md > https://github.com/SeleniumHQ/selenium/issues/1635 If callFromAsync, then either onSuccess or onFailure will be called on success or failure, respectively. It will be invoked asynchronously, *after* returning back to Javascript caller (i.e. to a non-Selenese layer that invoked this doCall()).
Parameters:
Name Type Attributes Default Description
funcName string
argSpec string | object Comma-separated assignments of Selenese function parameters. Or an object (easily passed within =<>...<> as per http://selite.github.io/EnhancedSelenese) - then its fields define the Selenese function parameters. See reference.xml.
invokedFromJavascript boolean <optional>
false Whether invoked from Javascript (rather than directly from Selenese)
onSuccess function <optional>
Callback function. Only used if invokedFromJavascript==true.
onFailure function <optional>
Callback function. Only used if invokedFromJavascript==true.
Source:

doInsertRecord(recordObject, table)

Parameters:
Name Type Description
recordObject object
table SeLiteData.Table
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:
Example
setImplicitWait | 0
     setImplicitWait | 1000

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:
Example
setImplicitWaitCondition |  0  |  
     setImplicitWaitCondition |  1000  | !window.Sys || !window.Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
     setImplicitWaitCondition |  1000  | !window.dojo || !window.dojo.io.XMLHTTPTransport.inFlight.length;
     setImplicitWaitCondition |  1000  | !window.Ajax || !window.Ajax.activeRequestCount;
     setImplicitWaitCondition |  1000  | !window.tapestry || !window.tapestry.isServingRequests();
     setImplicitWaitCondition |  1000  | !window.jQuery || !window.jQuery.active;

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:

doSleepUntilTimestampDistinctDownToMilliseconds()

This and similar functions have name starting with 'doSleepUntil'. That way when you type 'waitForDistinctTimestamp' in Selenium IDE, it doesn't auto-suggest '...AndWait' alternatives, which we don't want and which would confuse user. If the function name was any doXyz that doesn't start with 'doSleepUntil', Selenium IDE would auto-suggest '..AndWait' alternative, which don't make sense.
Source:

encodeFile(filePathOrURL, useURLencodingopt, contentHandleropt) → {Promise}

Encode a file as a data: URI. See https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs. It also loads content of files referenced by <img src="...">, <link href="..." with rel="stylesheet" or with as="script" or with type="...">, <script src="...">. It changes src="..." or href="..." of those elements to use data: containing the loaded content.
Parameters:
Name Type Attributes Default Description
filePathOrURL string File path or URL of the HTML/XML preview file/template. It must be a full URL (including the scheme/protocol), or a full path. If it's a file path, you can use either / or \ as directory separators (they will get translated for the current system). To make it portable, specify it as a relative path and pass it appended to result of SeLiteSettings.getTestSuiteFolder(). It must not be a data: URL. It must not contain a #hash/fragment part.
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
udefined Whether to apply base 64 encoding (human-unreadable) rather than URL encoding (English text is human-readable). Thri-state parameter: -If true, then this always uses URL encoding (the result may not work with decodeURIComponent()). -If undefined, then it's automatic: URL encoding for text files (whose MIME starts with "text/" and for .xhtml files) and base 64 for the rest. -If false, then this always uses base 64 encoding. -If a string, an array, a regex: matching MIME prefix for files to URL encode, in addition to the above automatic rule. -If a function, then useURLencoding(mimeString) determines whether to use URL encoding, in addition to the above automatic rule.
contentHandler function <optional>
Function(content) => Promise of a string (the handled content). Used for deep/recursive handling. Parameter url is used only for resolving relative URLs for documents that are handled recursively.
Source:
See:
  • Editor.prototype.openPreview()
Returns:
Promise that resolves to encoded content (and handled, if contentHandler is passed); it rejects on error or on timeout. On success it resolves to string, which is a data: URI for content of given documentURL, including content of images/scripts/stylesheets through data: URIs, too.
Type
Promise

encodeFileRecursiveHandler(filter)

Parameters:
Name Type Description
filter string | array | RegExp | function | undefined See Selenium.prototype.encodeFileRecursively().
Source:

encodeFileWithHandler(filePathOrURL, useURLencodingopt, fetchFilter, handleropt) → {Promise}

Parameters:
Name Type Attributes Description
filePathOrURL string See Selenium.prototype.encodeFile().
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
See Selenium.prototype.encodeFile().
fetchFilter string | array | RegExp | function | undefined Filter that determines for a given URL whether to fetch it or not. - String application webroot. Any resources under it, even if referenced through full URLs, will be fetched. - Array of webroots. Any resources under them will be fetched. - RegExp matching any URLs to fetch. - Function(url) that returns whether to fetch a URL. - undefined to fetch any URLs on the same server (or under same top folder/Windows volume).
handler function <optional>
Function (fetchFilter, useURLencoding, contentURL, content) => Promise.
Source:
Returns:
Promise of a string content.
Type
Promise

getReadRecord(info) → {object}

This is not called getRecord, because then autogenerated storeRecord would be confusing/counter-intuitive: it could imply that it's storing something in the DB, while it would be retrieving a record from the DB and storing it in a stored variable.
Parameters:
Name Type Description
info object
Source:
Returns:
Type
object

handlePotentialPromise(promiseOrResult, handleropt, withPromiseopt) → {function|undefined}

This functions streamlines handling of Promise (or potentially Promise) results in Selenese commands. Call it from Selenium.prototype.doYourFunction(first, second) and return its result value. That ensures the mechanism works for promiseOrResult being either a Promise or a non-Promise.
Parameters:
Name Type Attributes Default Description
promiseOrResult * | Promise
handler function <optional>
A callback function. If present, this will invoke it either - immediately if !withPromise, or - once the promise resolved (which can also be immediately), but not if it resolved after timing out
withPromise boolean <optional>
false Whether promiseOrResult should be a Promise, or not. This function validated promiseOrResult accordingly..
Source:
Returns:
Exactly if withPromise, then return a function to return back to Selenium (that will be used as continuation test) that checks the promise status of and promiseOrResult and it throws on timeout. Otherwise (i.e. !withPromise) return undefined (i.e. no need for a continuation test).
Type
function | undefined

loadFile(url, binaryopt) → {Promise}

Load a given file asynchronously.
Parameters:
Name Type Attributes Default Description
url string URL of the file. It must be a full URL (including the scheme/protocol).
binary boolean <optional>
false Whether it's a binary file. If unsure, pass true.
Source:
Returns:
A Promise that will resolve to content of the file: either to a string (if binary is not set/false), or to an ArrayBuffer (if binary is true). On failure or timeout it will be rejected.
Type
Promise

noteTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command. Use to record the moment when you inserted/updated a record of given type, and you want to compare that record's timestamp (whether soon or later) as formatted on the webpage (using given precision).

Warning: This keeps a count only of timestamps notes since you started Selenium IDE. If you re-started it soon after the previous run(s) which could record timestamps, make sure you wait for a sufficient period to get distinct new timestamps.
Parameters:
Name Type Description
string timestampName Type/use case group of the record that you're upgrading/inserting. Records that can be compared between each other should have same timestampName. Then this assures that they get timestamps that show up as distinct. Records with different timestampName can get same timestamps, because they are not supposed to be compared to each other.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds
Source:

preprocessParameter()

A head intercept of preprocessParameter() from chrome/content/selenium-core/scripts/selenium-api.js. It implements http://selite.github.io/EnhancedSelenese.
Source:

randomOption(string, paramsopt)

This returns a random option from within identified by a given locator. I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Attributes Default Description
string selectLocator Locator of the . It has to be an XPath-based locator, without 'xpath=' at the front.
params Object.<string, boolean> <optional>
{} Optional, an object in form { excludeFirst: true, // Whether to exclude the first option excludeLast: true, // Whether to exclude the last option }
Source:
Returns:
DOM Element of a random from within the select

randomText()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter. Return a random text, restricted by params, and fit for an input element identified by locator. It always returns at least 1 character.
Source:
Returns:
string as speficied in doTypeRandom()

setJavascriptPref()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

timestampComparesTo(string, number, number, bool)

Internal function, used to compare a displayed human-readable timestamp to a numeric timestamp, allowing for difference of maxTimeDifference() (milllisec) and this.defaultTimeout (ms) and 1x display time unit (displayPrecisionInSeconds). I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Description
string locator Selenium locator of the element that contains the displayed human-readable (and parsable) time stamp
number timestampInMilliseconds Expected timestamp, number of milliseconds since Epoch
number displayPrecisionInMilliseconds Smallest displayed time unit, in milliseconds
bool validatePrecision
Source:
To Do:
  • Use parameter timezone. Allow both short and long names? Make it daylightsaving-friendly, so that the test can run when daylightsaving changes - don't cache the time shift. This doesn't use timezone support in Date.parse(), because that only understands GMT, Z and US time zone abbreviations - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse and try Date.parse( "Fri, 11 Oct 2013 05:55:00 AEST" ) - it evaluates to NaN. evaluate in a .js file or via Firebug console, not via 'javascript:' url: new Intl.DateTimeFormat("en-GB", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/supportedLocalesOf This is on hold, pending https://bugzilla.mozilla.org/show_bug.cgi?id=837961. In Firefox 47.0a1 timezones seem to work one way only: new Intl.DateTimeFormat('en-AU', {timeZoneName: 'short'}).format( new Date() ) -> "12/02/2016, AEDT" new Intl.DateTimeFormat("en-AU", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) -> RangeError: invalid time zone new Intl.DateTimeFormat('en-AU', {timeZoneName: 'long'}).format( new Date() ) -> "12/02/2016, Australian Eastern Daylight Time" new Intl.DateTimeFormat("en-AU", {timeZone:"Australian Eastern Daylight Time", timeZoneName:'long'}).format( new Date()) -> RangeError: invalid time zone

waitForDistinctTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command.
Parameters:
Name Type Description
string timestampName label/name, usually of a timestamp element or field, for which you want to get a distinct timestamp.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds.
Source:
Returns:
true if it's safe to create a new timestamp for this type of record, and the timestamp will be distinguishable from the previous one.

Selenium

Members

distinctTimestamps

Anonymous object (serving as an associative array) { string timestampName: anonymous object { precision: number, the smallest unit of time displayed on the screen for respective timestamp elements nextDistinctTimestamp: number, a nearest future timestamp (in milliseconds) (that is, a value returned by Date.now() at that moment) when this timestampName can have a new distinct timestamp, which can be distinguished from the last one (and any older ones) using the given precision } where timestampName is a label/name, usually of a timestamp element or field (DB column), or of a whole fieldset (DB table) if it has only one timestamp field (column).
Source:

doTypeRobust :function

Type:
  • function
Source:
To Do:
  • eliminate? Or, keep, if we use NaN

evalWithExpandedStoredVars :function

SelBlocksGlobal: This is used instead of SelBlocks' evalWithVars(expr)
Type:
  • function
Source:

randomTopDomainsShort

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

Methods

(static) download({string) → {Promise}

Start downloading a file.
Parameters:
Name Type Description
{string url Full URL.
Source:
Returns:
As per https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm#fetch%28%29.
Type
Promise

(static) encodeContent(content) → {Promise}

Parameters:
Name Type Description
content string | ArrayBuffer
Source:
Returns:
Promise that resolved to encoded content; it rejects on error or on timeout.
Type
Promise

(static) recentWindow()

This allows to access .gBrowser. Other ways failed: window.gBrowser, selenium.browserbot.getCurrentWindow().gBrowser, window.opener.gBrowser.
Source:

(static) seLiteAfterCurrentCommand()

This will be appended after standard _executeCurrentCommand() through a tail override.
Source:

(static) seLiteBeforeCurrentCommand()

This will be inserted before standard _executeCurrentCommand() through a head override.
Source:

actionForIteratorObject(varName, extraValidationAndIterator)

Parameters:
Name Type Description
varName string
extraValidationAndIterator function Extra validation to run. No parameters. It must return an iterator object (not iterable, neither GeneratorFunction).
Source:

callBackInFlow(seleneseFunctionName, seleneseParameters)

'Synchronous' - i.e. for Javascript that is invoked from a Selenese script that is already running (via getEval or via custom Selenese command). It runs SelBlocks Global 'call' command for given Selenese function *after* the current Selenese command (i.e. getVal or custom Selenese command) finishes.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
To Do:
  • test stored var _result

callBackOutFlow(seleneseFunctionName, seleneseParameters) → {Promise}

'Asynchronous'- i.e. for Javascript invoked through e.g. SeLite Preview after a Selenese run finished.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
Returns:
A Promise object that will receive a Selenese return value on success, or an exception on failure. (It will be called after the Selenese run flow finished - i.e. through window.setTimeout().)
Type
Promise

callStack()

Solely for selenium-executionloop-handleAsTryBlock.js.
Source:

cascadeElseIf() → {undefined|function}

Source:
Returns:
Return a function exactly when withPromise==true. Otherwise return undefined.
Type
undefined | function

doCall(funcName, argSpec, invokedFromJavascriptopt, onSuccessopt, onFailureopt)

Note: See also ThirdPartyIssues.md > https://github.com/SeleniumHQ/selenium/issues/1635 If callFromAsync, then either onSuccess or onFailure will be called on success or failure, respectively. It will be invoked asynchronously, *after* returning back to Javascript caller (i.e. to a non-Selenese layer that invoked this doCall()).
Parameters:
Name Type Attributes Default Description
funcName string
argSpec string | object Comma-separated assignments of Selenese function parameters. Or an object (easily passed within =<>...<> as per http://selite.github.io/EnhancedSelenese) - then its fields define the Selenese function parameters. See reference.xml.
invokedFromJavascript boolean <optional>
false Whether invoked from Javascript (rather than directly from Selenese)
onSuccess function <optional>
Callback function. Only used if invokedFromJavascript==true.
onFailure function <optional>
Callback function. Only used if invokedFromJavascript==true.
Source:

doInsertRecord(recordObject, table)

Parameters:
Name Type Description
recordObject object
table SeLiteData.Table
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:
Example
setImplicitWait | 0
     setImplicitWait | 1000

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:
Example
setImplicitWaitCondition |  0  |  
     setImplicitWaitCondition |  1000  | !window.Sys || !window.Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
     setImplicitWaitCondition |  1000  | !window.dojo || !window.dojo.io.XMLHTTPTransport.inFlight.length;
     setImplicitWaitCondition |  1000  | !window.Ajax || !window.Ajax.activeRequestCount;
     setImplicitWaitCondition |  1000  | !window.tapestry || !window.tapestry.isServingRequests();
     setImplicitWaitCondition |  1000  | !window.jQuery || !window.jQuery.active;

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:

doSleepUntilTimestampDistinctDownToMilliseconds()

This and similar functions have name starting with 'doSleepUntil'. That way when you type 'waitForDistinctTimestamp' in Selenium IDE, it doesn't auto-suggest '...AndWait' alternatives, which we don't want and which would confuse user. If the function name was any doXyz that doesn't start with 'doSleepUntil', Selenium IDE would auto-suggest '..AndWait' alternative, which don't make sense.
Source:

encodeFile(filePathOrURL, useURLencodingopt, contentHandleropt) → {Promise}

Encode a file as a data: URI. See https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs. It also loads content of files referenced by <img src="...">, <link href="..." with rel="stylesheet" or with as="script" or with type="...">, <script src="...">. It changes src="..." or href="..." of those elements to use data: containing the loaded content.
Parameters:
Name Type Attributes Default Description
filePathOrURL string File path or URL of the HTML/XML preview file/template. It must be a full URL (including the scheme/protocol), or a full path. If it's a file path, you can use either / or \ as directory separators (they will get translated for the current system). To make it portable, specify it as a relative path and pass it appended to result of SeLiteSettings.getTestSuiteFolder(). It must not be a data: URL. It must not contain a #hash/fragment part.
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
udefined Whether to apply base 64 encoding (human-unreadable) rather than URL encoding (English text is human-readable). Thri-state parameter: -If true, then this always uses URL encoding (the result may not work with decodeURIComponent()). -If undefined, then it's automatic: URL encoding for text files (whose MIME starts with "text/" and for .xhtml files) and base 64 for the rest. -If false, then this always uses base 64 encoding. -If a string, an array, a regex: matching MIME prefix for files to URL encode, in addition to the above automatic rule. -If a function, then useURLencoding(mimeString) determines whether to use URL encoding, in addition to the above automatic rule.
contentHandler function <optional>
Function(content) => Promise of a string (the handled content). Used for deep/recursive handling. Parameter url is used only for resolving relative URLs for documents that are handled recursively.
Source:
See:
  • Editor.prototype.openPreview()
Returns:
Promise that resolves to encoded content (and handled, if contentHandler is passed); it rejects on error or on timeout. On success it resolves to string, which is a data: URI for content of given documentURL, including content of images/scripts/stylesheets through data: URIs, too.
Type
Promise

encodeFileRecursiveHandler(filter)

Parameters:
Name Type Description
filter string | array | RegExp | function | undefined See Selenium.prototype.encodeFileRecursively().
Source:

encodeFileWithHandler(filePathOrURL, useURLencodingopt, fetchFilter, handleropt) → {Promise}

Parameters:
Name Type Attributes Description
filePathOrURL string See Selenium.prototype.encodeFile().
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
See Selenium.prototype.encodeFile().
fetchFilter string | array | RegExp | function | undefined Filter that determines for a given URL whether to fetch it or not. - String application webroot. Any resources under it, even if referenced through full URLs, will be fetched. - Array of webroots. Any resources under them will be fetched. - RegExp matching any URLs to fetch. - Function(url) that returns whether to fetch a URL. - undefined to fetch any URLs on the same server (or under same top folder/Windows volume).
handler function <optional>
Function (fetchFilter, useURLencoding, contentURL, content) => Promise.
Source:
Returns:
Promise of a string content.
Type
Promise

getReadRecord(info) → {object}

This is not called getRecord, because then autogenerated storeRecord would be confusing/counter-intuitive: it could imply that it's storing something in the DB, while it would be retrieving a record from the DB and storing it in a stored variable.
Parameters:
Name Type Description
info object
Source:
Returns:
Type
object

handlePotentialPromise(promiseOrResult, handleropt, withPromiseopt) → {function|undefined}

This functions streamlines handling of Promise (or potentially Promise) results in Selenese commands. Call it from Selenium.prototype.doYourFunction(first, second) and return its result value. That ensures the mechanism works for promiseOrResult being either a Promise or a non-Promise.
Parameters:
Name Type Attributes Default Description
promiseOrResult * | Promise
handler function <optional>
A callback function. If present, this will invoke it either - immediately if !withPromise, or - once the promise resolved (which can also be immediately), but not if it resolved after timing out
withPromise boolean <optional>
false Whether promiseOrResult should be a Promise, or not. This function validated promiseOrResult accordingly..
Source:
Returns:
Exactly if withPromise, then return a function to return back to Selenium (that will be used as continuation test) that checks the promise status of and promiseOrResult and it throws on timeout. Otherwise (i.e. !withPromise) return undefined (i.e. no need for a continuation test).
Type
function | undefined

loadFile(url, binaryopt) → {Promise}

Load a given file asynchronously.
Parameters:
Name Type Attributes Default Description
url string URL of the file. It must be a full URL (including the scheme/protocol).
binary boolean <optional>
false Whether it's a binary file. If unsure, pass true.
Source:
Returns:
A Promise that will resolve to content of the file: either to a string (if binary is not set/false), or to an ArrayBuffer (if binary is true). On failure or timeout it will be rejected.
Type
Promise

noteTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command. Use to record the moment when you inserted/updated a record of given type, and you want to compare that record's timestamp (whether soon or later) as formatted on the webpage (using given precision).

Warning: This keeps a count only of timestamps notes since you started Selenium IDE. If you re-started it soon after the previous run(s) which could record timestamps, make sure you wait for a sufficient period to get distinct new timestamps.
Parameters:
Name Type Description
string timestampName Type/use case group of the record that you're upgrading/inserting. Records that can be compared between each other should have same timestampName. Then this assures that they get timestamps that show up as distinct. Records with different timestampName can get same timestamps, because they are not supposed to be compared to each other.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds
Source:

preprocessParameter()

A head intercept of preprocessParameter() from chrome/content/selenium-core/scripts/selenium-api.js. It implements http://selite.github.io/EnhancedSelenese.
Source:

randomOption(string, paramsopt)

This returns a random option from within identified by a given locator. I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Attributes Default Description
string selectLocator Locator of the . It has to be an XPath-based locator, without 'xpath=' at the front.
params Object.<string, boolean> <optional>
{} Optional, an object in form { excludeFirst: true, // Whether to exclude the first option excludeLast: true, // Whether to exclude the last option }
Source:
Returns:
DOM Element of a random from within the select

randomText()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter. Return a random text, restricted by params, and fit for an input element identified by locator. It always returns at least 1 character.
Source:
Returns:
string as speficied in doTypeRandom()

setJavascriptPref()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

timestampComparesTo(string, number, number, bool)

Internal function, used to compare a displayed human-readable timestamp to a numeric timestamp, allowing for difference of maxTimeDifference() (milllisec) and this.defaultTimeout (ms) and 1x display time unit (displayPrecisionInSeconds). I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Description
string locator Selenium locator of the element that contains the displayed human-readable (and parsable) time stamp
number timestampInMilliseconds Expected timestamp, number of milliseconds since Epoch
number displayPrecisionInMilliseconds Smallest displayed time unit, in milliseconds
bool validatePrecision
Source:
To Do:
  • Use parameter timezone. Allow both short and long names? Make it daylightsaving-friendly, so that the test can run when daylightsaving changes - don't cache the time shift. This doesn't use timezone support in Date.parse(), because that only understands GMT, Z and US time zone abbreviations - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse and try Date.parse( "Fri, 11 Oct 2013 05:55:00 AEST" ) - it evaluates to NaN. evaluate in a .js file or via Firebug console, not via 'javascript:' url: new Intl.DateTimeFormat("en-GB", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/supportedLocalesOf This is on hold, pending https://bugzilla.mozilla.org/show_bug.cgi?id=837961. In Firefox 47.0a1 timezones seem to work one way only: new Intl.DateTimeFormat('en-AU', {timeZoneName: 'short'}).format( new Date() ) -> "12/02/2016, AEDT" new Intl.DateTimeFormat("en-AU", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) -> RangeError: invalid time zone new Intl.DateTimeFormat('en-AU', {timeZoneName: 'long'}).format( new Date() ) -> "12/02/2016, Australian Eastern Daylight Time" new Intl.DateTimeFormat("en-AU", {timeZone:"Australian Eastern Daylight Time", timeZoneName:'long'}).format( new Date()) -> RangeError: invalid time zone

waitForDistinctTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command.
Parameters:
Name Type Description
string timestampName label/name, usually of a timestamp element or field, for which you want to get a distinct timestamp.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds.
Source:
Returns:
true if it's safe to create a new timestamp for this type of record, and the timestamp will be distinguishable from the previous one.

Selenium

Members

distinctTimestamps

Anonymous object (serving as an associative array) { string timestampName: anonymous object { precision: number, the smallest unit of time displayed on the screen for respective timestamp elements nextDistinctTimestamp: number, a nearest future timestamp (in milliseconds) (that is, a value returned by Date.now() at that moment) when this timestampName can have a new distinct timestamp, which can be distinguished from the last one (and any older ones) using the given precision } where timestampName is a label/name, usually of a timestamp element or field (DB column), or of a whole fieldset (DB table) if it has only one timestamp field (column).
Source:

doTypeRobust :function

Type:
  • function
Source:
To Do:
  • eliminate? Or, keep, if we use NaN

evalWithExpandedStoredVars :function

SelBlocksGlobal: This is used instead of SelBlocks' evalWithVars(expr)
Type:
  • function
Source:

randomTopDomainsShort

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

Methods

(static) download({string) → {Promise}

Start downloading a file.
Parameters:
Name Type Description
{string url Full URL.
Source:
Returns:
As per https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm#fetch%28%29.
Type
Promise

(static) encodeContent(content) → {Promise}

Parameters:
Name Type Description
content string | ArrayBuffer
Source:
Returns:
Promise that resolved to encoded content; it rejects on error or on timeout.
Type
Promise

(static) recentWindow()

This allows to access .gBrowser. Other ways failed: window.gBrowser, selenium.browserbot.getCurrentWindow().gBrowser, window.opener.gBrowser.
Source:

(static) seLiteAfterCurrentCommand()

This will be appended after standard _executeCurrentCommand() through a tail override.
Source:

(static) seLiteBeforeCurrentCommand()

This will be inserted before standard _executeCurrentCommand() through a head override.
Source:

actionForIteratorObject(varName, extraValidationAndIterator)

Parameters:
Name Type Description
varName string
extraValidationAndIterator function Extra validation to run. No parameters. It must return an iterator object (not iterable, neither GeneratorFunction).
Source:

callBackInFlow(seleneseFunctionName, seleneseParameters)

'Synchronous' - i.e. for Javascript that is invoked from a Selenese script that is already running (via getEval or via custom Selenese command). It runs SelBlocks Global 'call' command for given Selenese function *after* the current Selenese command (i.e. getVal or custom Selenese command) finishes.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
To Do:
  • test stored var _result

callBackOutFlow(seleneseFunctionName, seleneseParameters) → {Promise}

'Asynchronous'- i.e. for Javascript invoked through e.g. SeLite Preview after a Selenese run finished.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
Returns:
A Promise object that will receive a Selenese return value on success, or an exception on failure. (It will be called after the Selenese run flow finished - i.e. through window.setTimeout().)
Type
Promise

callStack()

Solely for selenium-executionloop-handleAsTryBlock.js.
Source:

cascadeElseIf() → {undefined|function}

Source:
Returns:
Return a function exactly when withPromise==true. Otherwise return undefined.
Type
undefined | function

doCall(funcName, argSpec, invokedFromJavascriptopt, onSuccessopt, onFailureopt)

Note: See also ThirdPartyIssues.md > https://github.com/SeleniumHQ/selenium/issues/1635 If callFromAsync, then either onSuccess or onFailure will be called on success or failure, respectively. It will be invoked asynchronously, *after* returning back to Javascript caller (i.e. to a non-Selenese layer that invoked this doCall()).
Parameters:
Name Type Attributes Default Description
funcName string
argSpec string | object Comma-separated assignments of Selenese function parameters. Or an object (easily passed within =<>...<> as per http://selite.github.io/EnhancedSelenese) - then its fields define the Selenese function parameters. See reference.xml.
invokedFromJavascript boolean <optional>
false Whether invoked from Javascript (rather than directly from Selenese)
onSuccess function <optional>
Callback function. Only used if invokedFromJavascript==true.
onFailure function <optional>
Callback function. Only used if invokedFromJavascript==true.
Source:

doInsertRecord(recordObject, table)

Parameters:
Name Type Description
recordObject object
table SeLiteData.Table
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:
Example
setImplicitWait | 0
     setImplicitWait | 1000

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:
Example
setImplicitWaitCondition |  0  |  
     setImplicitWaitCondition |  1000  | !window.Sys || !window.Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
     setImplicitWaitCondition |  1000  | !window.dojo || !window.dojo.io.XMLHTTPTransport.inFlight.length;
     setImplicitWaitCondition |  1000  | !window.Ajax || !window.Ajax.activeRequestCount;
     setImplicitWaitCondition |  1000  | !window.tapestry || !window.tapestry.isServingRequests();
     setImplicitWaitCondition |  1000  | !window.jQuery || !window.jQuery.active;

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:

doSleepUntilTimestampDistinctDownToMilliseconds()

This and similar functions have name starting with 'doSleepUntil'. That way when you type 'waitForDistinctTimestamp' in Selenium IDE, it doesn't auto-suggest '...AndWait' alternatives, which we don't want and which would confuse user. If the function name was any doXyz that doesn't start with 'doSleepUntil', Selenium IDE would auto-suggest '..AndWait' alternative, which don't make sense.
Source:

encodeFile(filePathOrURL, useURLencodingopt, contentHandleropt) → {Promise}

Encode a file as a data: URI. See https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs. It also loads content of files referenced by <img src="...">, <link href="..." with rel="stylesheet" or with as="script" or with type="...">, <script src="...">. It changes src="..." or href="..." of those elements to use data: containing the loaded content.
Parameters:
Name Type Attributes Default Description
filePathOrURL string File path or URL of the HTML/XML preview file/template. It must be a full URL (including the scheme/protocol), or a full path. If it's a file path, you can use either / or \ as directory separators (they will get translated for the current system). To make it portable, specify it as a relative path and pass it appended to result of SeLiteSettings.getTestSuiteFolder(). It must not be a data: URL. It must not contain a #hash/fragment part.
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
udefined Whether to apply base 64 encoding (human-unreadable) rather than URL encoding (English text is human-readable). Thri-state parameter: -If true, then this always uses URL encoding (the result may not work with decodeURIComponent()). -If undefined, then it's automatic: URL encoding for text files (whose MIME starts with "text/" and for .xhtml files) and base 64 for the rest. -If false, then this always uses base 64 encoding. -If a string, an array, a regex: matching MIME prefix for files to URL encode, in addition to the above automatic rule. -If a function, then useURLencoding(mimeString) determines whether to use URL encoding, in addition to the above automatic rule.
contentHandler function <optional>
Function(content) => Promise of a string (the handled content). Used for deep/recursive handling. Parameter url is used only for resolving relative URLs for documents that are handled recursively.
Source:
See:
  • Editor.prototype.openPreview()
Returns:
Promise that resolves to encoded content (and handled, if contentHandler is passed); it rejects on error or on timeout. On success it resolves to string, which is a data: URI for content of given documentURL, including content of images/scripts/stylesheets through data: URIs, too.
Type
Promise

encodeFileRecursiveHandler(filter)

Parameters:
Name Type Description
filter string | array | RegExp | function | undefined See Selenium.prototype.encodeFileRecursively().
Source:

encodeFileWithHandler(filePathOrURL, useURLencodingopt, fetchFilter, handleropt) → {Promise}

Parameters:
Name Type Attributes Description
filePathOrURL string See Selenium.prototype.encodeFile().
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
See Selenium.prototype.encodeFile().
fetchFilter string | array | RegExp | function | undefined Filter that determines for a given URL whether to fetch it or not. - String application webroot. Any resources under it, even if referenced through full URLs, will be fetched. - Array of webroots. Any resources under them will be fetched. - RegExp matching any URLs to fetch. - Function(url) that returns whether to fetch a URL. - undefined to fetch any URLs on the same server (or under same top folder/Windows volume).
handler function <optional>
Function (fetchFilter, useURLencoding, contentURL, content) => Promise.
Source:
Returns:
Promise of a string content.
Type
Promise

getReadRecord(info) → {object}

This is not called getRecord, because then autogenerated storeRecord would be confusing/counter-intuitive: it could imply that it's storing something in the DB, while it would be retrieving a record from the DB and storing it in a stored variable.
Parameters:
Name Type Description
info object
Source:
Returns:
Type
object

handlePotentialPromise(promiseOrResult, handleropt, withPromiseopt) → {function|undefined}

This functions streamlines handling of Promise (or potentially Promise) results in Selenese commands. Call it from Selenium.prototype.doYourFunction(first, second) and return its result value. That ensures the mechanism works for promiseOrResult being either a Promise or a non-Promise.
Parameters:
Name Type Attributes Default Description
promiseOrResult * | Promise
handler function <optional>
A callback function. If present, this will invoke it either - immediately if !withPromise, or - once the promise resolved (which can also be immediately), but not if it resolved after timing out
withPromise boolean <optional>
false Whether promiseOrResult should be a Promise, or not. This function validated promiseOrResult accordingly..
Source:
Returns:
Exactly if withPromise, then return a function to return back to Selenium (that will be used as continuation test) that checks the promise status of and promiseOrResult and it throws on timeout. Otherwise (i.e. !withPromise) return undefined (i.e. no need for a continuation test).
Type
function | undefined

loadFile(url, binaryopt) → {Promise}

Load a given file asynchronously.
Parameters:
Name Type Attributes Default Description
url string URL of the file. It must be a full URL (including the scheme/protocol).
binary boolean <optional>
false Whether it's a binary file. If unsure, pass true.
Source:
Returns:
A Promise that will resolve to content of the file: either to a string (if binary is not set/false), or to an ArrayBuffer (if binary is true). On failure or timeout it will be rejected.
Type
Promise

noteTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command. Use to record the moment when you inserted/updated a record of given type, and you want to compare that record's timestamp (whether soon or later) as formatted on the webpage (using given precision).

Warning: This keeps a count only of timestamps notes since you started Selenium IDE. If you re-started it soon after the previous run(s) which could record timestamps, make sure you wait for a sufficient period to get distinct new timestamps.
Parameters:
Name Type Description
string timestampName Type/use case group of the record that you're upgrading/inserting. Records that can be compared between each other should have same timestampName. Then this assures that they get timestamps that show up as distinct. Records with different timestampName can get same timestamps, because they are not supposed to be compared to each other.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds
Source:

preprocessParameter()

A head intercept of preprocessParameter() from chrome/content/selenium-core/scripts/selenium-api.js. It implements http://selite.github.io/EnhancedSelenese.
Source:

randomOption(string, paramsopt)

This returns a random option from within identified by a given locator. I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Attributes Default Description
string selectLocator Locator of the . It has to be an XPath-based locator, without 'xpath=' at the front.
params Object.<string, boolean> <optional>
{} Optional, an object in form { excludeFirst: true, // Whether to exclude the first option excludeLast: true, // Whether to exclude the last option }
Source:
Returns:
DOM Element of a random from within the select

randomText()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter. Return a random text, restricted by params, and fit for an input element identified by locator. It always returns at least 1 character.
Source:
Returns:
string as speficied in doTypeRandom()

setJavascriptPref()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

timestampComparesTo(string, number, number, bool)

Internal function, used to compare a displayed human-readable timestamp to a numeric timestamp, allowing for difference of maxTimeDifference() (milllisec) and this.defaultTimeout (ms) and 1x display time unit (displayPrecisionInSeconds). I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Description
string locator Selenium locator of the element that contains the displayed human-readable (and parsable) time stamp
number timestampInMilliseconds Expected timestamp, number of milliseconds since Epoch
number displayPrecisionInMilliseconds Smallest displayed time unit, in milliseconds
bool validatePrecision
Source:
To Do:
  • Use parameter timezone. Allow both short and long names? Make it daylightsaving-friendly, so that the test can run when daylightsaving changes - don't cache the time shift. This doesn't use timezone support in Date.parse(), because that only understands GMT, Z and US time zone abbreviations - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse and try Date.parse( "Fri, 11 Oct 2013 05:55:00 AEST" ) - it evaluates to NaN. evaluate in a .js file or via Firebug console, not via 'javascript:' url: new Intl.DateTimeFormat("en-GB", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/supportedLocalesOf This is on hold, pending https://bugzilla.mozilla.org/show_bug.cgi?id=837961. In Firefox 47.0a1 timezones seem to work one way only: new Intl.DateTimeFormat('en-AU', {timeZoneName: 'short'}).format( new Date() ) -> "12/02/2016, AEDT" new Intl.DateTimeFormat("en-AU", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) -> RangeError: invalid time zone new Intl.DateTimeFormat('en-AU', {timeZoneName: 'long'}).format( new Date() ) -> "12/02/2016, Australian Eastern Daylight Time" new Intl.DateTimeFormat("en-AU", {timeZone:"Australian Eastern Daylight Time", timeZoneName:'long'}).format( new Date()) -> RangeError: invalid time zone

waitForDistinctTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command.
Parameters:
Name Type Description
string timestampName label/name, usually of a timestamp element or field, for which you want to get a distinct timestamp.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds.
Source:
Returns:
true if it's safe to create a new timestamp for this type of record, and the timestamp will be distinguishable from the previous one.

Selenium

Members

distinctTimestamps

Anonymous object (serving as an associative array) { string timestampName: anonymous object { precision: number, the smallest unit of time displayed on the screen for respective timestamp elements nextDistinctTimestamp: number, a nearest future timestamp (in milliseconds) (that is, a value returned by Date.now() at that moment) when this timestampName can have a new distinct timestamp, which can be distinguished from the last one (and any older ones) using the given precision } where timestampName is a label/name, usually of a timestamp element or field (DB column), or of a whole fieldset (DB table) if it has only one timestamp field (column).
Source:

doTypeRobust :function

Type:
  • function
Source:
To Do:
  • eliminate? Or, keep, if we use NaN

evalWithExpandedStoredVars :function

SelBlocksGlobal: This is used instead of SelBlocks' evalWithVars(expr)
Type:
  • function
Source:

randomTopDomainsShort

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

Methods

(static) download({string) → {Promise}

Start downloading a file.
Parameters:
Name Type Description
{string url Full URL.
Source:
Returns:
As per https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm#fetch%28%29.
Type
Promise

(static) encodeContent(content) → {Promise}

Parameters:
Name Type Description
content string | ArrayBuffer
Source:
Returns:
Promise that resolved to encoded content; it rejects on error or on timeout.
Type
Promise

(static) recentWindow()

This allows to access .gBrowser. Other ways failed: window.gBrowser, selenium.browserbot.getCurrentWindow().gBrowser, window.opener.gBrowser.
Source:

(static) seLiteAfterCurrentCommand()

This will be appended after standard _executeCurrentCommand() through a tail override.
Source:

(static) seLiteBeforeCurrentCommand()

This will be inserted before standard _executeCurrentCommand() through a head override.
Source:

actionForIteratorObject(varName, extraValidationAndIterator)

Parameters:
Name Type Description
varName string
extraValidationAndIterator function Extra validation to run. No parameters. It must return an iterator object (not iterable, neither GeneratorFunction).
Source:

callBackInFlow(seleneseFunctionName, seleneseParameters)

'Synchronous' - i.e. for Javascript that is invoked from a Selenese script that is already running (via getEval or via custom Selenese command). It runs SelBlocks Global 'call' command for given Selenese function *after* the current Selenese command (i.e. getVal or custom Selenese command) finishes.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
To Do:
  • test stored var _result

callBackOutFlow(seleneseFunctionName, seleneseParameters) → {Promise}

'Asynchronous'- i.e. for Javascript invoked through e.g. SeLite Preview after a Selenese run finished.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
Returns:
A Promise object that will receive a Selenese return value on success, or an exception on failure. (It will be called after the Selenese run flow finished - i.e. through window.setTimeout().)
Type
Promise

callStack()

Solely for selenium-executionloop-handleAsTryBlock.js.
Source:

cascadeElseIf() → {undefined|function}

Source:
Returns:
Return a function exactly when withPromise==true. Otherwise return undefined.
Type
undefined | function

doCall(funcName, argSpec, invokedFromJavascriptopt, onSuccessopt, onFailureopt)

Note: See also ThirdPartyIssues.md > https://github.com/SeleniumHQ/selenium/issues/1635 If callFromAsync, then either onSuccess or onFailure will be called on success or failure, respectively. It will be invoked asynchronously, *after* returning back to Javascript caller (i.e. to a non-Selenese layer that invoked this doCall()).
Parameters:
Name Type Attributes Default Description
funcName string
argSpec string | object Comma-separated assignments of Selenese function parameters. Or an object (easily passed within =<>...<> as per http://selite.github.io/EnhancedSelenese) - then its fields define the Selenese function parameters. See reference.xml.
invokedFromJavascript boolean <optional>
false Whether invoked from Javascript (rather than directly from Selenese)
onSuccess function <optional>
Callback function. Only used if invokedFromJavascript==true.
onFailure function <optional>
Callback function. Only used if invokedFromJavascript==true.
Source:

doInsertRecord(recordObject, table)

Parameters:
Name Type Description
recordObject object
table SeLiteData.Table
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:
Example
setImplicitWait | 0
     setImplicitWait | 1000

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:
Example
setImplicitWaitCondition |  0  |  
     setImplicitWaitCondition |  1000  | !window.Sys || !window.Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
     setImplicitWaitCondition |  1000  | !window.dojo || !window.dojo.io.XMLHTTPTransport.inFlight.length;
     setImplicitWaitCondition |  1000  | !window.Ajax || !window.Ajax.activeRequestCount;
     setImplicitWaitCondition |  1000  | !window.tapestry || !window.tapestry.isServingRequests();
     setImplicitWaitCondition |  1000  | !window.jQuery || !window.jQuery.active;

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:

doSleepUntilTimestampDistinctDownToMilliseconds()

This and similar functions have name starting with 'doSleepUntil'. That way when you type 'waitForDistinctTimestamp' in Selenium IDE, it doesn't auto-suggest '...AndWait' alternatives, which we don't want and which would confuse user. If the function name was any doXyz that doesn't start with 'doSleepUntil', Selenium IDE would auto-suggest '..AndWait' alternative, which don't make sense.
Source:

encodeFile(filePathOrURL, useURLencodingopt, contentHandleropt) → {Promise}

Encode a file as a data: URI. See https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs. It also loads content of files referenced by <img src="...">, <link href="..." with rel="stylesheet" or with as="script" or with type="...">, <script src="...">. It changes src="..." or href="..." of those elements to use data: containing the loaded content.
Parameters:
Name Type Attributes Default Description
filePathOrURL string File path or URL of the HTML/XML preview file/template. It must be a full URL (including the scheme/protocol), or a full path. If it's a file path, you can use either / or \ as directory separators (they will get translated for the current system). To make it portable, specify it as a relative path and pass it appended to result of SeLiteSettings.getTestSuiteFolder(). It must not be a data: URL. It must not contain a #hash/fragment part.
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
udefined Whether to apply base 64 encoding (human-unreadable) rather than URL encoding (English text is human-readable). Thri-state parameter: -If true, then this always uses URL encoding (the result may not work with decodeURIComponent()). -If undefined, then it's automatic: URL encoding for text files (whose MIME starts with "text/" and for .xhtml files) and base 64 for the rest. -If false, then this always uses base 64 encoding. -If a string, an array, a regex: matching MIME prefix for files to URL encode, in addition to the above automatic rule. -If a function, then useURLencoding(mimeString) determines whether to use URL encoding, in addition to the above automatic rule.
contentHandler function <optional>
Function(content) => Promise of a string (the handled content). Used for deep/recursive handling. Parameter url is used only for resolving relative URLs for documents that are handled recursively.
Source:
See:
  • Editor.prototype.openPreview()
Returns:
Promise that resolves to encoded content (and handled, if contentHandler is passed); it rejects on error or on timeout. On success it resolves to string, which is a data: URI for content of given documentURL, including content of images/scripts/stylesheets through data: URIs, too.
Type
Promise

encodeFileRecursiveHandler(filter)

Parameters:
Name Type Description
filter string | array | RegExp | function | undefined See Selenium.prototype.encodeFileRecursively().
Source:

encodeFileWithHandler(filePathOrURL, useURLencodingopt, fetchFilter, handleropt) → {Promise}

Parameters:
Name Type Attributes Description
filePathOrURL string See Selenium.prototype.encodeFile().
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
See Selenium.prototype.encodeFile().
fetchFilter string | array | RegExp | function | undefined Filter that determines for a given URL whether to fetch it or not. - String application webroot. Any resources under it, even if referenced through full URLs, will be fetched. - Array of webroots. Any resources under them will be fetched. - RegExp matching any URLs to fetch. - Function(url) that returns whether to fetch a URL. - undefined to fetch any URLs on the same server (or under same top folder/Windows volume).
handler function <optional>
Function (fetchFilter, useURLencoding, contentURL, content) => Promise.
Source:
Returns:
Promise of a string content.
Type
Promise

getReadRecord(info) → {object}

This is not called getRecord, because then autogenerated storeRecord would be confusing/counter-intuitive: it could imply that it's storing something in the DB, while it would be retrieving a record from the DB and storing it in a stored variable.
Parameters:
Name Type Description
info object
Source:
Returns:
Type
object

handlePotentialPromise(promiseOrResult, handleropt, withPromiseopt) → {function|undefined}

This functions streamlines handling of Promise (or potentially Promise) results in Selenese commands. Call it from Selenium.prototype.doYourFunction(first, second) and return its result value. That ensures the mechanism works for promiseOrResult being either a Promise or a non-Promise.
Parameters:
Name Type Attributes Default Description
promiseOrResult * | Promise
handler function <optional>
A callback function. If present, this will invoke it either - immediately if !withPromise, or - once the promise resolved (which can also be immediately), but not if it resolved after timing out
withPromise boolean <optional>
false Whether promiseOrResult should be a Promise, or not. This function validated promiseOrResult accordingly..
Source:
Returns:
Exactly if withPromise, then return a function to return back to Selenium (that will be used as continuation test) that checks the promise status of and promiseOrResult and it throws on timeout. Otherwise (i.e. !withPromise) return undefined (i.e. no need for a continuation test).
Type
function | undefined

loadFile(url, binaryopt) → {Promise}

Load a given file asynchronously.
Parameters:
Name Type Attributes Default Description
url string URL of the file. It must be a full URL (including the scheme/protocol).
binary boolean <optional>
false Whether it's a binary file. If unsure, pass true.
Source:
Returns:
A Promise that will resolve to content of the file: either to a string (if binary is not set/false), or to an ArrayBuffer (if binary is true). On failure or timeout it will be rejected.
Type
Promise

noteTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command. Use to record the moment when you inserted/updated a record of given type, and you want to compare that record's timestamp (whether soon or later) as formatted on the webpage (using given precision).

Warning: This keeps a count only of timestamps notes since you started Selenium IDE. If you re-started it soon after the previous run(s) which could record timestamps, make sure you wait for a sufficient period to get distinct new timestamps.
Parameters:
Name Type Description
string timestampName Type/use case group of the record that you're upgrading/inserting. Records that can be compared between each other should have same timestampName. Then this assures that they get timestamps that show up as distinct. Records with different timestampName can get same timestamps, because they are not supposed to be compared to each other.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds
Source:

preprocessParameter()

A head intercept of preprocessParameter() from chrome/content/selenium-core/scripts/selenium-api.js. It implements http://selite.github.io/EnhancedSelenese.
Source:

randomOption(string, paramsopt)

This returns a random option from within identified by a given locator. I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Attributes Default Description
string selectLocator Locator of the . It has to be an XPath-based locator, without 'xpath=' at the front.
params Object.<string, boolean> <optional>
{} Optional, an object in form { excludeFirst: true, // Whether to exclude the first option excludeLast: true, // Whether to exclude the last option }
Source:
Returns:
DOM Element of a random from within the select

randomText()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter. Return a random text, restricted by params, and fit for an input element identified by locator. It always returns at least 1 character.
Source:
Returns:
string as speficied in doTypeRandom()

setJavascriptPref()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

timestampComparesTo(string, number, number, bool)

Internal function, used to compare a displayed human-readable timestamp to a numeric timestamp, allowing for difference of maxTimeDifference() (milllisec) and this.defaultTimeout (ms) and 1x display time unit (displayPrecisionInSeconds). I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Description
string locator Selenium locator of the element that contains the displayed human-readable (and parsable) time stamp
number timestampInMilliseconds Expected timestamp, number of milliseconds since Epoch
number displayPrecisionInMilliseconds Smallest displayed time unit, in milliseconds
bool validatePrecision
Source:
To Do:
  • Use parameter timezone. Allow both short and long names? Make it daylightsaving-friendly, so that the test can run when daylightsaving changes - don't cache the time shift. This doesn't use timezone support in Date.parse(), because that only understands GMT, Z and US time zone abbreviations - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse and try Date.parse( "Fri, 11 Oct 2013 05:55:00 AEST" ) - it evaluates to NaN. evaluate in a .js file or via Firebug console, not via 'javascript:' url: new Intl.DateTimeFormat("en-GB", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/supportedLocalesOf This is on hold, pending https://bugzilla.mozilla.org/show_bug.cgi?id=837961. In Firefox 47.0a1 timezones seem to work one way only: new Intl.DateTimeFormat('en-AU', {timeZoneName: 'short'}).format( new Date() ) -> "12/02/2016, AEDT" new Intl.DateTimeFormat("en-AU", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) -> RangeError: invalid time zone new Intl.DateTimeFormat('en-AU', {timeZoneName: 'long'}).format( new Date() ) -> "12/02/2016, Australian Eastern Daylight Time" new Intl.DateTimeFormat("en-AU", {timeZone:"Australian Eastern Daylight Time", timeZoneName:'long'}).format( new Date()) -> RangeError: invalid time zone

waitForDistinctTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command.
Parameters:
Name Type Description
string timestampName label/name, usually of a timestamp element or field, for which you want to get a distinct timestamp.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds.
Source:
Returns:
true if it's safe to create a new timestamp for this type of record, and the timestamp will be distinguishable from the previous one.

Selenium

Members

distinctTimestamps

Anonymous object (serving as an associative array) { string timestampName: anonymous object { precision: number, the smallest unit of time displayed on the screen for respective timestamp elements nextDistinctTimestamp: number, a nearest future timestamp (in milliseconds) (that is, a value returned by Date.now() at that moment) when this timestampName can have a new distinct timestamp, which can be distinguished from the last one (and any older ones) using the given precision } where timestampName is a label/name, usually of a timestamp element or field (DB column), or of a whole fieldset (DB table) if it has only one timestamp field (column).
Source:

doTypeRobust :function

Type:
  • function
Source:
To Do:
  • eliminate? Or, keep, if we use NaN

evalWithExpandedStoredVars :function

SelBlocksGlobal: This is used instead of SelBlocks' evalWithVars(expr)
Type:
  • function
Source:

randomTopDomainsShort

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

Methods

(static) download({string) → {Promise}

Start downloading a file.
Parameters:
Name Type Description
{string url Full URL.
Source:
Returns:
As per https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm#fetch%28%29.
Type
Promise

(static) encodeContent(content) → {Promise}

Parameters:
Name Type Description
content string | ArrayBuffer
Source:
Returns:
Promise that resolved to encoded content; it rejects on error or on timeout.
Type
Promise

(static) recentWindow()

This allows to access .gBrowser. Other ways failed: window.gBrowser, selenium.browserbot.getCurrentWindow().gBrowser, window.opener.gBrowser.
Source:

(static) seLiteAfterCurrentCommand()

This will be appended after standard _executeCurrentCommand() through a tail override.
Source:

(static) seLiteBeforeCurrentCommand()

This will be inserted before standard _executeCurrentCommand() through a head override.
Source:

actionForIteratorObject(varName, extraValidationAndIterator)

Parameters:
Name Type Description
varName string
extraValidationAndIterator function Extra validation to run. No parameters. It must return an iterator object (not iterable, neither GeneratorFunction).
Source:

callBackInFlow(seleneseFunctionName, seleneseParameters)

'Synchronous' - i.e. for Javascript that is invoked from a Selenese script that is already running (via getEval or via custom Selenese command). It runs SelBlocks Global 'call' command for given Selenese function *after* the current Selenese command (i.e. getVal or custom Selenese command) finishes.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
To Do:
  • test stored var _result

callBackOutFlow(seleneseFunctionName, seleneseParameters) → {Promise}

'Asynchronous'- i.e. for Javascript invoked through e.g. SeLite Preview after a Selenese run finished.
Parameters:
Name Type Description
seleneseFunctionName string Selenese function name.
seleneseParameters string | object Selenese function parameters. See doCall().
Source:
Returns:
A Promise object that will receive a Selenese return value on success, or an exception on failure. (It will be called after the Selenese run flow finished - i.e. through window.setTimeout().)
Type
Promise

callStack()

Solely for selenium-executionloop-handleAsTryBlock.js.
Source:

cascadeElseIf() → {undefined|function}

Source:
Returns:
Return a function exactly when withPromise==true. Otherwise return undefined.
Type
undefined | function

doCall(funcName, argSpec, invokedFromJavascriptopt, onSuccessopt, onFailureopt)

Note: See also ThirdPartyIssues.md > https://github.com/SeleniumHQ/selenium/issues/1635 If callFromAsync, then either onSuccess or onFailure will be called on success or failure, respectively. It will be invoked asynchronously, *after* returning back to Javascript caller (i.e. to a non-Selenese layer that invoked this doCall()).
Parameters:
Name Type Attributes Default Description
funcName string
argSpec string | object Comma-separated assignments of Selenese function parameters. Or an object (easily passed within =<>...<> as per http://selite.github.io/EnhancedSelenese) - then its fields define the Selenese function parameters. See reference.xml.
invokedFromJavascript boolean <optional>
false Whether invoked from Javascript (rather than directly from Selenese)
onSuccess function <optional>
Callback function. Only used if invokedFromJavascript==true.
onFailure function <optional>
Callback function. Only used if invokedFromJavascript==true.
Source:

doInsertRecord(recordObject, table)

Parameters:
Name Type Description
recordObject object
table SeLiteData.Table
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:

doSetImplicitWait(timeout)

Specifies the amount of time it should wait when searching for an element if it is not immediately present.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
Source:
Example
setImplicitWait | 0
     setImplicitWait | 1000

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:
Example
setImplicitWaitCondition |  0  |  
     setImplicitWaitCondition |  1000  | !window.Sys || !window.Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
     setImplicitWaitCondition |  1000  | !window.dojo || !window.dojo.io.XMLHTTPTransport.inFlight.length;
     setImplicitWaitCondition |  1000  | !window.Ajax || !window.Ajax.activeRequestCount;
     setImplicitWaitCondition |  1000  | !window.tapestry || !window.tapestry.isServingRequests();
     setImplicitWaitCondition |  1000  | !window.jQuery || !window.jQuery.active;

doSetImplicitWaitCondition(timeout, condition_js)

Specifies the amount of time it should wait for a condition to be true to continue to the next command.
Parameters:
Name Type Description
timeout Integer Timeout in millisecond, set 0 to disable it
condition_js String Javascript logical expression that need to be true to execute each command.
Source:

doSleepUntilTimestampDistinctDownToMilliseconds()

This and similar functions have name starting with 'doSleepUntil'. That way when you type 'waitForDistinctTimestamp' in Selenium IDE, it doesn't auto-suggest '...AndWait' alternatives, which we don't want and which would confuse user. If the function name was any doXyz that doesn't start with 'doSleepUntil', Selenium IDE would auto-suggest '..AndWait' alternative, which don't make sense.
Source:

encodeFile(filePathOrURL, useURLencodingopt, contentHandleropt) → {Promise}

Encode a file as a data: URI. See https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs. It also loads content of files referenced by <img src="...">, <link href="..." with rel="stylesheet" or with as="script" or with type="...">, <script src="...">. It changes src="..." or href="..." of those elements to use data: containing the loaded content.
Parameters:
Name Type Attributes Default Description
filePathOrURL string File path or URL of the HTML/XML preview file/template. It must be a full URL (including the scheme/protocol), or a full path. If it's a file path, you can use either / or \ as directory separators (they will get translated for the current system). To make it portable, specify it as a relative path and pass it appended to result of SeLiteSettings.getTestSuiteFolder(). It must not be a data: URL. It must not contain a #hash/fragment part.
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
udefined Whether to apply base 64 encoding (human-unreadable) rather than URL encoding (English text is human-readable). Thri-state parameter: -If true, then this always uses URL encoding (the result may not work with decodeURIComponent()). -If undefined, then it's automatic: URL encoding for text files (whose MIME starts with "text/" and for .xhtml files) and base 64 for the rest. -If false, then this always uses base 64 encoding. -If a string, an array, a regex: matching MIME prefix for files to URL encode, in addition to the above automatic rule. -If a function, then useURLencoding(mimeString) determines whether to use URL encoding, in addition to the above automatic rule.
contentHandler function <optional>
Function(content) => Promise of a string (the handled content). Used for deep/recursive handling. Parameter url is used only for resolving relative URLs for documents that are handled recursively.
Source:
See:
  • Editor.prototype.openPreview()
Returns:
Promise that resolves to encoded content (and handled, if contentHandler is passed); it rejects on error or on timeout. On success it resolves to string, which is a data: URI for content of given documentURL, including content of images/scripts/stylesheets through data: URIs, too.
Type
Promise

encodeFileRecursiveHandler(filter)

Parameters:
Name Type Description
filter string | array | RegExp | function | undefined See Selenium.prototype.encodeFileRecursively().
Source:

encodeFileWithHandler(filePathOrURL, useURLencodingopt, fetchFilter, handleropt) → {Promise}

Parameters:
Name Type Attributes Description
filePathOrURL string See Selenium.prototype.encodeFile().
useURLencoding boolean | undefined | string | Array | RegExp | function <optional>
See Selenium.prototype.encodeFile().
fetchFilter string | array | RegExp | function | undefined Filter that determines for a given URL whether to fetch it or not. - String application webroot. Any resources under it, even if referenced through full URLs, will be fetched. - Array of webroots. Any resources under them will be fetched. - RegExp matching any URLs to fetch. - Function(url) that returns whether to fetch a URL. - undefined to fetch any URLs on the same server (or under same top folder/Windows volume).
handler function <optional>
Function (fetchFilter, useURLencoding, contentURL, content) => Promise.
Source:
Returns:
Promise of a string content.
Type
Promise

getReadRecord(info) → {object}

This is not called getRecord, because then autogenerated storeRecord would be confusing/counter-intuitive: it could imply that it's storing something in the DB, while it would be retrieving a record from the DB and storing it in a stored variable.
Parameters:
Name Type Description
info object
Source:
Returns:
Type
object

handlePotentialPromise(promiseOrResult, handleropt, withPromiseopt) → {function|undefined}

This functions streamlines handling of Promise (or potentially Promise) results in Selenese commands. Call it from Selenium.prototype.doYourFunction(first, second) and return its result value. That ensures the mechanism works for promiseOrResult being either a Promise or a non-Promise.
Parameters:
Name Type Attributes Default Description
promiseOrResult * | Promise
handler function <optional>
A callback function. If present, this will invoke it either - immediately if !withPromise, or - once the promise resolved (which can also be immediately), but not if it resolved after timing out
withPromise boolean <optional>
false Whether promiseOrResult should be a Promise, or not. This function validated promiseOrResult accordingly..
Source:
Returns:
Exactly if withPromise, then return a function to return back to Selenium (that will be used as continuation test) that checks the promise status of and promiseOrResult and it throws on timeout. Otherwise (i.e. !withPromise) return undefined (i.e. no need for a continuation test).
Type
function | undefined

loadFile(url, binaryopt) → {Promise}

Load a given file asynchronously.
Parameters:
Name Type Attributes Default Description
url string URL of the file. It must be a full URL (including the scheme/protocol).
binary boolean <optional>
false Whether it's a binary file. If unsure, pass true.
Source:
Returns:
A Promise that will resolve to content of the file: either to a string (if binary is not set/false), or to an ArrayBuffer (if binary is true). On failure or timeout it will be rejected.
Type
Promise

noteTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command. Use to record the moment when you inserted/updated a record of given type, and you want to compare that record's timestamp (whether soon or later) as formatted on the webpage (using given precision).

Warning: This keeps a count only of timestamps notes since you started Selenium IDE. If you re-started it soon after the previous run(s) which could record timestamps, make sure you wait for a sufficient period to get distinct new timestamps.
Parameters:
Name Type Description
string timestampName Type/use case group of the record that you're upgrading/inserting. Records that can be compared between each other should have same timestampName. Then this assures that they get timestamps that show up as distinct. Records with different timestampName can get same timestamps, because they are not supposed to be compared to each other.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds
Source:

preprocessParameter()

A head intercept of preprocessParameter() from chrome/content/selenium-core/scripts/selenium-api.js. It implements http://selite.github.io/EnhancedSelenese.
Source:

randomOption(string, paramsopt)

This returns a random option from within identified by a given locator. I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Attributes Default Description
string selectLocator Locator of the . It has to be an XPath-based locator, without 'xpath=' at the front.
params Object.<string, boolean> <optional>
{} Optional, an object in form { excludeFirst: true, // Whether to exclude the first option excludeLast: true, // Whether to exclude the last option }
Source:
Returns:
DOM Element of a random from within the select

randomText()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter. Return a random text, restricted by params, and fit for an input element identified by locator. It always returns at least 1 character.
Source:
Returns:
string as speficied in doTypeRandom()

setJavascriptPref()

I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Source:

timestampComparesTo(string, number, number, bool)

Internal function, used to compare a displayed human-readable timestamp to a numeric timestamp, allowing for difference of maxTimeDifference() (milllisec) and this.defaultTimeout (ms) and 1x display time unit (displayPrecisionInSeconds). I don't use prefix 'do' or 'get' in the name of this function because it's not intended to be run as Selenium command/getter.
Parameters:
Name Type Description
string locator Selenium locator of the element that contains the displayed human-readable (and parsable) time stamp
number timestampInMilliseconds Expected timestamp, number of milliseconds since Epoch
number displayPrecisionInMilliseconds Smallest displayed time unit, in milliseconds
bool validatePrecision
Source:
To Do:
  • Use parameter timezone. Allow both short and long names? Make it daylightsaving-friendly, so that the test can run when daylightsaving changes - don't cache the time shift. This doesn't use timezone support in Date.parse(), because that only understands GMT, Z and US time zone abbreviations - see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse and try Date.parse( "Fri, 11 Oct 2013 05:55:00 AEST" ) - it evaluates to NaN. evaluate in a .js file or via Firebug console, not via 'javascript:' url: new Intl.DateTimeFormat("en-GB", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/supportedLocalesOf This is on hold, pending https://bugzilla.mozilla.org/show_bug.cgi?id=837961. In Firefox 47.0a1 timezones seem to work one way only: new Intl.DateTimeFormat('en-AU', {timeZoneName: 'short'}).format( new Date() ) -> "12/02/2016, AEDT" new Intl.DateTimeFormat("en-AU", {timeZone:"AEDT", timeZoneName:'short'}).format( new Date()) -> RangeError: invalid time zone new Intl.DateTimeFormat('en-AU', {timeZoneName: 'long'}).format( new Date() ) -> "12/02/2016, Australian Eastern Daylight Time" new Intl.DateTimeFormat("en-AU", {timeZone:"Australian Eastern Daylight Time", timeZoneName:'long'}).format( new Date()) -> RangeError: invalid time zone

waitForDistinctTimestamp(string, int)

I don't use prefix 'do' in the name of this function because it's not intended to be run as Selenium command.
Parameters:
Name Type Description
string timestampName label/name, usually of a timestamp element or field, for which you want to get a distinct timestamp.
int timestampPrecision, the precision (lowest unit) of the timestamp, in milliseconds.
Source:
Returns:
true if it's safe to create a new timestamp for this type of record, and the timestamp will be distinguishable from the previous one.