Embedded frameworks / headless browsers

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

For details on testing web apps in an Internet Explorer embedded browser control, see Internet Explorer embedded browser controls.

Caution: The instructions in this topic include downloading executable files from the Internet, such as chromedriver.exe and WebView2 driver which are not provided by OpenText.

We encourage you to use only genuine executable files from the official Chrome and NW.js Internet sites. Failing to comply with this recommendation may expose your system to increased security risks. Any and all associated risks are the Customer's responsibility and OpenText will not be held accountable for the same.

Supported frameworks / Headless browsers

OpenText Functional Testing can test Web apps developed with the following frameworks and Headless browsers using standard GUI testing support:

Chromium-based frameworks
  • Chromium Embedded Framework (CEF)

    Chromium Embedded Framework support is applicable for Java CEF, CEF Sharp, and Adobe CEP. CEF in this topic refers to all of the above.

  • Electron

  • JxBrowser

  • NW.js

Before you test Chromium-based frameworks, see Connect to your Web app.

Microsoft Edge WebView2 Before you test Web apps embedded in Microsoft Edge WebView2, see Connect to your Web app.
Headless browsers

Before you test headless Chrome, see Prepare to run tests on Headless Chrome.

Note: Recording on Headless Chrome is not supported.

These advanced frameworks and browsers are not supported for other Web-based add-ins, such as .NET Web Forms, Web-based SAP, Siebel, and Java. However, they are supported in Web extensibility-based add-ins, such as Web 2.0 Toolkits.

Back to top

Connect to your Web app

Before recording or running tests on Web apps developed with Chromium-based frameworks or Microsoft Edge WebView2, connect OpenText Functional Testing to your Web app:

To connect OpenText Functional Testing to your Web app:

  1. Prepare the web driver.

    Make sure the web driver that matches the version of the embedded browser is stored on your computer.

    CEF, Electron, and JxBrowser 114 or earlier

    Download the ChromeDriver from the official Chrome for Developers website.

    115 or later

    Download the Chrome for Testing from the Chrome for Testing availability dashboard. If you cannot find the version that matches the framework version, download it from Google Chrome Labs < Chrome for Testing.

    Microsoft Edge WebView2 Download the WebView2 driver from the Microsoft Edge WebDriver download page.
    NW.js

    Download the NW.js SDK, which includes the chromedriver.exe file.

  2. For CEF, Electron, and JxBrowser, replace the chromedriver.exe file in the <Installdir>\bin\WebDriver directory with the version that matches your application.

    For NW.js, copy the chromedriver.exe file to the <Installdir>\bin\WebDriver\NW directory.

    Alternatively, you can use different versions of ChromeDriver for different applications. Store the chromedriver.exe file in different locations, and provide the path to the relevant ChromeDriver in the call to WebUtil.AttachRemoteDebugging.

  3. Configure your embedded browser to always open a port for remote debugging. For instructions on how to do this, check your embedded browser's documentation.

    Note the port number, to use in subsequent steps.

    Example: In the CEF folder, open a command prompt and run the following command: cefclient.exe --remote-debugging-port=<port number>

    The default way for an official WebView2 application to listen to debugging port is to add environment variable WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS and set its value to --remote-debugging-port=<port>.

  4. Do one of the following to connect to your Web app.

    • Add the remote address and remote debugging port number for your Web app in the Remote Connections pane of the Options dialog box. This enables OpenText Functional Testing to find the application's objects.

      To use this method, you must perform the second step.

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

    • Add the following statements to your test or component to enable OpenText Functional Testing to attach to the application. In these statements, provide the remote IP address, remote debugging port number, and web driver path.

      Chromium-based frameworks

      WebUtil.AttachRemoteDebugging "localhost:<port>", "default", "<DriverPath>"

      Microsoft Edge WebView2

      WebUtil.AttachRemoteDebugging "localhost:<port>", "MsEdgeWebView2", "<DriverPath>"

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

      To detach from the application, use the following statement:

      WebUtil.DetachRemoteDebugging "localhost:<port>"

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

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

Back to top

Configure connections on a remote machine

If you are using a Chromium-based framework and running an OpenText Functional Testing script on a remote machine, additionally configure the remote machine as follows:

  1. Install socat after downloading it from the Internet according to the remote machine's operating system (Mac or Windows).

  2. Run the socat command:

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

    Where:

    <x> is the port number on the target machine that OpenText Functional Testing tries to access

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

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

OpenText Functional Testing is now able to work with remote applications through the port you defined for <x>.

Back to top

Prepare to run tests on Headless Chrome

Before running your tests on Headless Chrome, you have to perform some preparatory steps.

To prepare to run tests on Headless Chrome:

  1. Check whether the ChromeDriver installed with OpenText Functional Testing matches the version of Headless Chrome you are using. If not, refer to the following table to get the correct ChromeDriver:

    Headless Chrome 114 or earlier Download the ChromeDriver from the official Chrome for Developers website.
    Headless Chrome 115 or later

    Download the Chrome for Testing from the Chrome for Testing availability dashboard. If you cannot find the version that matches the framework version, download it from Google Chrome Labs < Chrome for Testing.

    Replace the chromedriver.exe file in the <Installdir>\bin\WebDriver directory with the correct chromedriver.exe file.

  2. Select Google Headless Chrome as your browser in the Record and Run Settings dialog box.

  3. If you want to run steps that use AI object identification, we recommend enlarging the default browser size to make sure that all the controls you want to test are visible.

    The browser size is controlled by the --window-size parameter (unit: pixel).

    Add the browser size setting to the end of the <Installdir>\bin\mic.ini file. For example:

    Copy code
    [ChromeHeadlessOption]
    --window-size=1920x1080

Back to top

See also: