function downloadManager_getElement(spec) {
    var elem = null;

    switch(spec.type) {
      /**
       * subtype: subtype of property to match
       * value: value of property to match
       */
      case "download":
        // Use a temporary lookup to get the download item
        var download = new elementslib.Lookup(this._controller.window.document,
                                              '/id("downloadManager")/id("downloadView")/' +
                                              '{"' + spec.subtype + '":"' + spec.value + '"}');
        this._controller.waitForElement(download, gTimeout);

        // Use its download id to construct the real lookup expression
        elem = new elementslib.Lookup(this._controller.window.document,
                                      '/id("downloadManager")/id("downloadView")/' +
                                      'id("' + download.getNode().getAttribute('id') + '")');
        break;

      /**
       * subtype: Identifier of the specified download button (cancel, pause, resume, retry)
       * value: Entry (download) of the download list
       */
      case "download_button":
        // XXX: Bug 555347 - There are outstanding events to process
        this._controller.sleep(0);

        elem = new elementslib.Lookup(this._controller.window.document, spec.value.expression +
                                      '/anon({"flex":"1"})/[1]/[1]/{"cmd":"cmd_' + spec.subtype + '"}');
        break;
      default:
        throw new Error(arguments.callee.name + ": Unknown element type - " + spec.type);
    }

    return elem;
  }
function downloadManager_getElement(spec) {
    var elem = null;

    switch(spec.type) {
      /**
       * subtype: subtype of property to match
       * value: value of property to match
       */
      case "download":
        // Use a temporary lookup to get the download item
        var download = new elementslib.Lookup(this._controller.window.document,
                                              '/id("downloadManager")/id("downloadView")/' +
                                              '{"' + spec.subtype + '":"' + spec.value + '"}');
        this._controller.waitForElement(download, gTimeout);

        // Use its download id to construct the real lookup expression
        elem = new elementslib.Lookup(this._controller.window.document,
                                      '/id("downloadManager")/id("downloadView")/' +
                                      'id("' + download.getNode().getAttribute('id') + '")');
        break;

      /**
       * subtype: Identifier of the specified download button (cancel, pause, resume, retry)
       * value: Entry (download) of the download list
       */
      case "download_button":
        // XXX: Bug 555347 - There are outstanding events to process
        this._controller.sleep(0);

        elem = new elementslib.Lookup(this._controller.window.document, spec.value.expression +
                                      '/anon({"flex":"1"})/[1]/[1]/{"cmd":"cmd_' + spec.subtype + '"}');
        break;
      default:
        throw new Error(arguments.callee.name + ": Unknown element type - " + spec.type);
    }

    return elem;
  }
function downloadManager_getElement ( spec ) { var elem = null ; switch ( spec . type ) { /**
       * subtype: subtype of property to match
       * value: value of property to match
       */ case "download" : // Use a temporary lookup to get the download item var download = new elementslib . Lookup ( this . _controller . window . document , '/id("downloadManager")/id("downloadView")/' + '{"' + spec . subtype + '":"' + spec . value + '"}' ) ; this . _controller . waitForElement ( download , gTimeout ) ; // Use its download id to construct the real lookup expression elem = new elementslib . Lookup ( this . _controller . window . document , '/id("downloadManager")/id("downloadView")/' + 'id("' + download . getNode ( ) . getAttribute ( 'id' ) + '")' ) ; break ; /**
       * subtype: Identifier of the specified download button (cancel, pause, resume, retry)
       * value: Entry (download) of the download list
       */ case "download_button" : // XXX: Bug 555347 - There are outstanding events to process this . _controller . sleep ( 0 ) ; elem = new elementslib . Lookup ( this . _controller . window . document , spec . value . expression + '/anon({"flex":"1"})/[1]/[1]/{"cmd":"cmd_' + spec . subtype + '"}' ) ; break ; default : throw new Error ( arguments . callee . name + ": Unknown element type - " + spec . type ) ; } return elem ; }
Retrieve an UI element based on the given spec

@param {object} spec
Information of the UI element which should be retrieved
type: General type information
subtype: Specific element or property
value: Value of the element or property
@returns Element which has been created
@type {ElemBase}
Retrieve an UI element based on the given spec
Returns the element that matches the specified specification