mozilla
Your Search Results

    autoCompleteResults

    This class simplifies access to elements in the location bar's autocomplete popup.

    Method overview

    autoCompleteResults(in MozMillController controller);
    ElemBase getElement(in object spec);
    ElemBase getResult(in number index);
    array of string getUnderlinedText(in ElemBase result, in string type);

    Attributes

    Attribute Type Description
    allResults array ElemBase Get all auto-complete results.
    controller MozMillController Get the controller of the browser window to operate on.
    isOpened boolean Indicates if the auto-complete pop-up is open.
    length number Count of all auto-complete entries.
    selectedIndex number Get the currently selected index.
    visibleResults array ElemBase Get all visible auto-complete results.

    Methods

    autoCompleteResults()

    Constructor of the class.

    autoCompleteResults(
      in MozMillController controller
    );
    Parameters
    controller
    Mozmill controller of the browser window to operate on.

    getElement()

    Retrieves a UI element based on the given spec object.

    ElemBase getElement(
      in object spec
    );
    Parameters
    spec
    JSON object which specifies the element to retrieve. Use its attributes to specify the exact element. This example will show the correct usage.
    spec.type  (string)
    spec.subtype (string) spec.value (mixed) Description
    "popup" -
    -
    Get the auto-complete pop-up.
    "results" -
    -
    Get all the auto-complete results.
    "result" - index (number)
    Get the result at the specified index.
    Return value

    ElemBase instance of the requested element which matches the specifications.

    getResult()

    Returns the auto-complete result element at the given index.

    ElemBase getResult(
      in number index
    );
    Parameters
    index
    Index of the auto-complete result.
    Return value

    The ElemBase object describing the specified result element.

    getUnderlinedText()

    Returns the text which is underlined in the title or URL.

    assertTextUnderlined(
      in ElemBase result,
      in string type
    );
    Parameters

    result

    The result which has to be checked.

    type

    The element to check. Possible values are title and url.

    Returns

    List of strings which are underlined.

    Examples

    This example shows how to check if the specified text is underlined in the title of an auto-complete result.

    var RELATIVE_ROOT = '../../shared-modules';
    var MODULE_REQUIRES = ['ToolbarAPI'];
    
    var setupModule = function(module)
    {
      module.controller = mozmill.getBrowserController();
      module.locationBar = new ToolbarAPI.locationBar(controller);
    }
    
    var testTitleUnderlined = function()
    {
      locationBar.type("foo");
      locationBar.toggleAutocompletePopup();
    
      var richlistItem = locationBar.autoCompleteResults.getResult(0);
      var text = locationBar.autoCompleteResults.getUnderlinedText(richlistItem, "title");
    }
    

    Document Tags and Contributors

    Contributors to this page: Whimboo, Sheppy
    Last updated by: Sheppy,