Troubleshooting and Limitations - Developing Support

This section describes troubleshooting and limitations for developing Web Add-in Extensibility support.

  • Web Add-in Extensibility can be used to create support for Web controls within Web pages and frames. You cannot develop custom support for Web pages or frames themselves. In other words, you cannot map a Web page or frame to a test object class you developed using Web Add-in Extensibility.

  • For UFT One to successfully use support developed using Web Add-in Extensibility, the browser's security settings must be set to allow active scripting.

  • When designing a JavaScript function, it is not possible to click a link on a Mozilla Firefox page using a simple Click or FireEvent method call. The Web Add-in Extensibility _util object provides a special FireEvent method that you can use to click links in this situation. (The method is not documented in the API Reference, as it is meant to be used only for this type of workaround).

    This is an example of how you would use this method:

    function clickOnLink(link) {
        if (_util.GetBrowserType() == QtpConstants.IE) {
            link.click();
        }
        else {
            //Firefox.
            var evObj = window.document.createEvent("MouseEvents");
            evObj.initEvent("click", true, true);
            _util.FireEvent(link, "click", evObj);
        }
    }
    
  • The util.Wait function is not supported for Firefox or Chrome browsers.

    Workaround: Use the HPPromise function, located in the common.js file (<UFT One installation directory>dat\Extensibility\Web\Toolkits\Common.js).

    To use the HPPromise function, do the following:

    1. Create an HPPromise object
    2. Use window.setTimeout to postpone the code that should be run after a specified number of milliseconds
    3. Return the HPPromise object
    4. At the end of running code that is timed out, call resolve or reject on the HPPromise object.

    For example:

    function SelectBook(bookIndex)
                // Select the radio button for the specified index and click the "Select" link.
            {
                if (bookIndex > BookCount()) {
                    // Display an error message in Internet Explorer.
                    _util.Alert("Book index '" + BookIndex + "' is out of range !");
                    // Fail the step and cause UFT to display a run-time error.
                    throw "Book index is out of range !";
                }
                // Select the radio button corresponding to the specified index.
                GetTableElem().rows[1 + bookIndex].cells[0].children[0].click();
                // Wait a while to enable users to see that the correct radio button is selected.
                var promise = new HPPromise();
                window.setTimeout(function () {
                    try {
                        // Click the "Select" link (the 3rd child of the DIV element).
                        _elem.children[2].click();
                        _util.LogLine("Running SelectBook test object method.", 1);
                        promise.resolve(true);
                    } catch (e) {
                        promise.reject(e);
                    }
                }, 1000);
    
                return promise;
            } 

    This is in comparison to how it is done with the util.Wait function:

  • By default, UFT One uses jQuery version 1.3.2 with Web Extensibility. If you need to upgrade to a newer jQuery version, do the following:

    1. Download a newer version of Jquery at http://jquery.com/download/.

    2. Back up the jQuery-x.x.x.js and jquery.simulate.x.x.x.js files found in the <UFT installation directory>/bin/JSFiles/jquery-1.3.2.js directory.
    3. Rename the jQuery-x.x.x.js file to jquery-1.3.2.js.
    4. If necessary, restart UFT One and load your Web Extensibility add-in.