javascript/selenium-core/scripts/ui-element.js
function UISpecifier(uiSpecifierStringOrPagesetName, elementName, args)
{
    /**
     * Initializes this object from a UI specifier string of the form:
     *
     *     pagesetName::elementName(arg1=value1, arg2=value2, ...)
     *
     * into its component parts, and returns them as an object.
     *
     * @return  an object containing the components of the UI specifier
     * @throws  UISpecifierException
     */
    this._initFromUISpecifierString = function(uiSpecifierString) {
        var matches = /^(.*)::([^\(]+)\((.*)\)$/.exec(uiSpecifierString);
        if (matches == null) {
            throw new UISpecifierException('Error in '
                + 'UISpecifier._initFromUISpecifierString(): "'
                + this.string + '" is not a valid UI specifier string');
        }
        this.pagesetName = matches[1];
        this.elementName = matches[2];
        this.args = (matches[3]) ? parse_kwargs(matches[3]) : {};
    };
    
    
    
    /**
     * Override the toString() method to return the UI specifier string when
     * evaluated in a string context. Combines the UI specifier components into
     * a canonical UI specifier string and returns it.
     *
     * @return   a UI specifier string
     */
    this.toString = function() {
        // empty string is acceptable for the path, but it must be defined
        if (this.pagesetName == undefined) {
            throw new UISpecifierException('Error in UISpecifier.toString(): "'
                + this.pagesetName + '" is not a valid UI specifier pageset '
                + 'name');
        }
        if (!this.elementName) {
            throw new UISpecifierException('Error in UISpecifier.unparse(): "'
                + this.elementName + '" is not a valid UI specifier element '
                + 'name');
        }
        if (!this.args) {
            throw new UISpecifierException('Error in UISpecifier.unparse(): "'
                + this.args + '" are not valid UI specifier args');
        }
        
        uiElement = UIMap.getInstance()
            .getUIElement(this.pagesetName, this.elementName);
        if (uiElement != null) {
            var kwargs = to_kwargs(this.args, uiElement.argsOrder);
        }
        else {
            // probably under unit test
            var kwargs = to_kwargs(this.args);
        }
        
        return this.pagesetName + '::' + this.elementName + '(' + kwargs + ')';
    };
    
    // construct the object
    if (arguments.length < 2) {
        this._initFromUISpecifierString(uiSpecifierStringOrPagesetName);
    }
    else {
        this.pagesetName = uiSpecifierStringOrPagesetName;
        this.elementName = elementName;
        this.args = (args) ? clone(args) : {};
    }
}
function UISpecifier(uiSpecifierStringOrPagesetName, elementName, args)
{
    /**
     * Initializes this object from a UI specifier string of the form:
     *
     *     pagesetName::elementName(arg1=value1, arg2=value2, ...)
     *
     * into its component parts, and returns them as an object.
     *
     * @return  an object containing the components of the UI specifier
     * @throws  UISpecifierException
     */
    this._initFromUISpecifierString = function(uiSpecifierString) {
        var matches = /^(.*)::([^\(]+)\((.*)\)$/.exec(uiSpecifierString);
        if (matches == null) {
            throw new UISpecifierException('Error in '
                + 'UISpecifier._initFromUISpecifierString(): "'
                + this.string + '" is not a valid UI specifier string');
        }
        this.pagesetName = matches[1];
        this.elementName = matches[2];
        this.args = (matches[3]) ? parse_kwargs(matches[3]) : {};
    };
    
    
    
    /**
     * Override the toString() method to return the UI specifier string when
     * evaluated in a string context. Combines the UI specifier components into
     * a canonical UI specifier string and returns it.
     *
     * @return   a UI specifier string
     */
    this.toString = function() {
        // empty string is acceptable for the path, but it must be defined
        if (this.pagesetName == undefined) {
            throw new UISpecifierException('Error in UISpecifier.toString(): "'
                + this.pagesetName + '" is not a valid UI specifier pageset '
                + 'name');
        }
        if (!this.elementName) {
            throw new UISpecifierException('Error in UISpecifier.unparse(): "'
                + this.elementName + '" is not a valid UI specifier element '
                + 'name');
        }
        if (!this.args) {
            throw new UISpecifierException('Error in UISpecifier.unparse(): "'
                + this.args + '" are not valid UI specifier args');
        }
        
        uiElement = UIMap.getInstance()
            .getUIElement(this.pagesetName, this.elementName);
        if (uiElement != null) {
            var kwargs = to_kwargs(this.args, uiElement.argsOrder);
        }
        else {
            // probably under unit test
            var kwargs = to_kwargs(this.args);
        }
        
        return this.pagesetName + '::' + this.elementName + '(' + kwargs + ')';
    };
    
    // construct the object
    if (arguments.length < 2) {
        this._initFromUISpecifierString(uiSpecifierStringOrPagesetName);
    }
    else {
        this.pagesetName = uiSpecifierStringOrPagesetName;
        this.elementName = elementName;
        this.args = (args) ? clone(args) : {};
    }
}
function UISpecifier ( uiSpecifierStringOrPagesetName , elementName , args ) { /**
     * Initializes this object from a UI specifier string of the form:
     *
     *     pagesetName::elementName(arg1=value1, arg2=value2, ...)
     *
     * into its component parts, and returns them as an object.
     *
     * @return  an object containing the components of the UI specifier
     * @throws  UISpecifierException
     */ this . _initFromUISpecifierString = function ( uiSpecifierString ) { var matches = / ^(.*)::([^\(]+)\((.*)\)$ / . exec ( uiSpecifierString ) ; if ( matches == null ) { throw new UISpecifierException ( 'Error in ' + 'UISpecifier._initFromUISpecifierString(): "' + this . string + '" is not a valid UI specifier string' ) ; } this . pagesetName = matches [ 1 ] ; this . elementName = matches [ 2 ] ; this . args = ( matches [ 3 ] ) ? parse_kwargs ( matches [ 3 ] ) : { } ; } ; /**
     * Override the toString() method to return the UI specifier string when
     * evaluated in a string context. Combines the UI specifier components into
     * a canonical UI specifier string and returns it.
     *
     * @return   a UI specifier string
     */ this . toString = function ( ) { // empty string is acceptable for the path, but it must be defined if ( this . pagesetName == undefined ) { throw new UISpecifierException ( 'Error in UISpecifier.toString(): "' + this . pagesetName + '" is not a valid UI specifier pageset ' + 'name' ) ; } if ( ! this . elementName ) { throw new UISpecifierException ( 'Error in UISpecifier.unparse(): "' + this . elementName + '" is not a valid UI specifier element ' + 'name' ) ; } if ( ! this . args ) { throw new UISpecifierException ( 'Error in UISpecifier.unparse(): "' + this . args + '" are not valid UI specifier args' ) ; } uiElement = UIMap . getInstance ( ) . getUIElement ( this . pagesetName , this . elementName ) ; if ( uiElement != null ) { var kwargs = to_kwargs ( this . args , uiElement . argsOrder ) ; } else { // probably under unit test var kwargs = to_kwargs ( this . args ) ; } return this . pagesetName + '::' + this . elementName + '(' + kwargs + ')' ; } ; // construct the object if ( arguments . length < 2 ) { this . _initFromUISpecifierString ( uiSpecifierStringOrPagesetName ) ; } else { this . pagesetName = uiSpecifierStringOrPagesetName ; this . elementName = elementName ; this . args = ( args ) ? clone ( args ) : { } ; } }
The UISpecifier constructor is overloaded. If less than three arguments are
provided, the first argument will be considered a UI specifier string, and
will be split out accordingly. Otherwise, the first argument will be
considered the path.

@param uiSpecifierStringOrPagesetName  a UI specifier string, or the pageset
name of the UI specifier
@param elementName  the name of the element
@param args         an object associating keys to values

@return  new UISpecifier object
The UISpecifier constructor is overloaded . If less than three arguments are provided the first argument will be considered a UI specifier string and will be split out accordingly . Otherwise the first argument will be considered the path .