Embedded frameworks / headless browsers

This topic describes how to get started with testing Web apps in embedded frameworks, or when testing headless browsers.

Supported frameworks

UFT can record and run tests using standard GUI testing support on Web apps developed with the following frameworks:

  • Chromium Embedded Framework (CEF). Chromium Embedded Framework support is applicable for Java CEF and Adobe CEP. The details in this topic apply to both Java CEF and Adobe CEP.

  • Electron

  • NW.js

  • PhantomJS

These advanced frameworks are not supported for other Web-based add-ins, such as .NET Web Forms, Web-based SAP, Siebel, Java, or the Web 2.0 Toolkits.

Back to top

Connect to your Web app

Before recording or running your test, do the following:

Define UFT options

Add the remote address for your Web app in the Remote Connections pane of the Options dialog box. This enables UFT to find the application's objects when recording.

For details, see Web Remote Connections Pane (Options Dialog Box > GUI Testing Tab).

Prepare your UFT machine

Perform additional steps on your UFT machine when testing specific frameworks. For details, see:

Testing on a remote machine If you are running a UFT script on a remote machine, continue with Configure connections on a remote machine before you run your test.

Programatically connect or disconnect from your app

Add the following statements to your test or component to enable UFT to attach or detach from the application:

  • WebUtil.AttachRemoteDebugging

  • WebUtil.DetachRemoteDebugging

For more details, see the WebUtil object in the Utility section of the UFT Object Model Reference for GUI Testing.

Note: UFT cannot identify objects in your application if you have manually closed the connection to that application.

Back to top

NW.js Framework

To test Web apps that are embedded in the NW.js framework, UFT communicates with the NW.js framework via the NW.js WebDriver.

Before testing your NW.js application, ensure that the NW.js WebDriver is present in the UFT installation folder.

Do the following:

  1. Browse to https://nwjs.io/, and download the SDK, which includes the chromedriver.exe file.
  2. Copy the chromedriver.exe file to the <UFT installation folder>/bin/WebDriver/NW directory.

Back to top

PhantomJS framework

Run tests on the PhantomJS toolkit without any changes in your existing test.

To do this, perform the following steps:

  1. Add the phantomjs.exe file to the <UFT installation folder>/bin/PhantomJS directory.

    This file is accessible as part of your PhantomJS download. For details, see http://phantomjs.org

  2. In the Record and Run Settings, select PhantomJS as your browser.

When you run your test, UFT will launch the installed version of PhantomJS and run the test on the toolkit.

Note: Recording is not supported for PhantomJS.

Back to top

Configure connections on a remote machine

If you are running a UFT script on a remote machine, additionally configure the remote machine as follows:

  1. Install socat from one of the following locations:

    Mac: http://macappstore.org/socat/

    Windows: http://www.dest-unreach.org/socat/download/

  2. Run the socat command:

    socat tcp-listen:<x>,fork tcp:localhost:<y>

    Where:

    <x> is the port number on the target machine that UFT tries to access

    <y> is the CEP port exposed for debugging on the target machine

  3. Disable or change the firewall to allow the relevant port.

UFT is now able to work with remote applications through port you defined for <x>.

For more details, see: http://stackoverflow.com/questions/6827310/chrome-remote-debugging-doesnt-work-with-ip

Back to top

See also: