Considerations for Web Testing

Applies to TestComplete 15.46, last modified on January 09, 2023

This topic contains considerations and specifics regarding testing web applications with TestComplete. See also Possible Issues With Web Testing.

Common Considerations

  • Before you record or run web tests, make sure you configure web browsers as explained in the Preparing Web Browsers section.

  • When the Use CSS pixels for scaled pages option is enabled, TestComplete recalculates sizes of web page elements and their coordinates on web pages to take into account the browser’s zoom and the system DPI setting.

    When this option is disabled, the system DPI setting and the browser zoom must be set to 100%. Otherwise, TestComplete will not be able to correctly identify these values.

  • When testing HTML input fields, keep in mind that their text is specified by the value attribute. It is not included in the innerHTML and outerHTML properties (although they can include the initial text displayed in the input field).

    For example, web comparison checkpoints verify the page’s HTML markup and therefore do not check values of input fields. To verify the inputted value, use a property checkpoint for the value attribute of the input field.

  • When you close the Edge browser, its process may not be terminated and remains in the system. The Sys.Browser("*") or Sys.Browser methods and other script statements that return an active browser will return the Browser object that matches the running Edge instance. This might cause issues for tests that check whether a browser is running or not. Please keep this in mind and modify your tests, if needed.

Chrome and Edge Chromium

  • The legacy (non-Chromium) Edge version is not supported.

  • Chrome running in Modern UI (Metro) mode is not supported.

  • To access the page content in Chrome or Edge, the SmartBear Test Extension embeds its scripts into the page. If JavaScript is disabled in the web browser, the test engine won’t be able to access the page contents. You can enable JavaScript on the Content Settings page. It is chrome://settings/content in Chrome and edge://settings/content in Edge respectively.

  • The hierarchy of web page elements is displayed either as the Tree (recommended) or DOM (obsolete) object model. If some other object model is chosen, it is treated as the Tree model.

  • Due to limitations of the browser native messaging protocol, the size of parameters passed to web page scripts cannot exceed 1 MB.

  • For security reasons, Chrome and Edge refuse all extensions to inject code into their internal pages (about:*, chrome:*, edge:*). Because of that, internal pages, like the new tab page, the extension manager, the download manager, the history page and so on, are not accessible to TestComplete.

  • To test web pages stored on the local computer, you need to enable the Allow access to file URLs option of the SmartBear Test Extension.

  • By default, Chrome and Edge follow the same-origin policy and do not allow cross-origin interaction. Because of this, TestComplete cannot access the content of cross-origin frames. If a host of an element, for example, of an iframe element, differs from the host of the parent page, TestComplete will not be able to access the element’s content.

    To access the content of such elements, you can do any of the following:

    • Open the frame as a separate web page.

    – or –

    • Disable the same-origin security restriction in the web browser. To do this:

      1. Make sure that the SitePerProcess policy is disabled in the browser. To get the list of policies applied to your browser:

        In Chrome, open the chrome://policy page.

        In Edge, open the edge://policy page.

        If the policy is hidden, select the Show policies with no value check box at the top of the page.

      2. Launch the web browser with the following command-line arguments:

        --disable-web-security

        --user-data-dir=<ProfilePath>

        --disable-site-isolation-trials

    The same-origin policy also applies to frames displaying local files. The local files are considered to belong to different origins and not allowed to access one from another. To access local files, you can launch the browser with the --allow-file-access-from-files command-line switch.

    These command-line arguments impair the browser security. We do not recommend using them unless required by your testing needs.

  • TestComplete cannot get page contents if the Content-Security-Policy response header is set to unsafe-inline. To avoid this problem, do not use the Content-Security-Policy header in your tested application or use another browser for testing.

  • To execute the JavaScript eval function in a frame in Chrome or Edge, use syntax that includes the frame ID and double eval. See Executing JavaScript in Frames in Chrome and Edge.

  • While recording or performing long-term automated tests, the browser hang monitor can consider the SmartBear Test Extension to be stalled and re-launch it.

    To prevent such behavior, TestComplete disables the hang monitor when the browser is run using the Run Browser keyword test operation or the Browsers.Item(...).Run scripting method. If you launch the browser in some other way, we recommend that you disable the monitor by using the --disable-hang-monitor command-line switch.

  • Recording tests against complex pages in Chrome or Edge with Test Visualizer set to the Capture tested object properties mode may negatively affect Chrome performance. If you experience slowdowns, disable this option or disable Test Visualizer entirely.

  • Testing Silverlight applications is not supported.

Internet Explorer

  • The Modern UI (Metro) version of Internet Explorer 11 is not supported.

  • To test web applications in Internet Explorer 11 on Windows 10, you must disable multiple processes in Internet Explorer.

  • Automated patching of Silverlight applications is not supported in Internet Explorer 11. You need to patch your Silverlight application manually. For instructions, see Preparing Applications With the tcAgPatcher Utility.

  • When testing Flash and Flex applications, keep in mind the following:

    • The FlashInjector approach is not supported in Internet Explorer on Windows 10, because the debug version of Flash Player cannot be installed. You can still use Firefox or Chrome with the Flash Player debugger.

    • The MSAA approach is not supported in Internet Explorer 11 on Windows 8.1 and later.

  • To test web pages stored on the local computer in Internet Explorer 11, you need to enable the Allow active content to run in files on My Computer option.

  • After closing a tab in Internet Explorer 11 or navigating a tab to another page, the old Page object may remain in the browser’s object hierarchy for some time. This is the actual lifetime of browser tab objects in Internet Explorer.

  • TestComplete may not be able to access the Login dialog if it is invoked by a domain other than the domain to which the page that is currently open in the browser belongs. For more information, see Login Object.

  • In the Object Browser panel, the object tree displays Internet Explorer windows as separate Browser("iexplore") nodes. For easier testing, each of these nodes contains all the pages that are open in all Internet Explorer windows, so you do not need to address a specific window in your tests.

  • On Windows Server operating systems TestComplete may fail to retrieve information on web page objects. To overcome this issue, add the tested site to the list of trusted sites.

  • If the compatibility mode is enabled in Internet Explorer, TestComplete will not be able to record cross-platform web tests in it. To disable the compatibility mode in Internet Explorer:

    1. In the web browser, select the Tools > Compatibility View settings.

    2. In Internet Explorer 11, clear the Display intranet sites in Compatibility View check box.

      In Internet Explorer 10, clear the Display all websites in Compatibility View and Display intranet sites in Compatibility View check boxes.

    In addition, we recommend that you use Google Chrome or Firefox to record cross-platform web tests instead of Internet Explorer.

Embedded Browsers

TestComplete supports web testing in applications that use the Microsoft WebBrowser control or Chromium web browser (in CEF-based and Electron-based applications). Such applications are recognized as generic Windows applications, however, TestComplete uses its web testing abilities to expose the hierarchy of web pages displayed in the embedded browser.

To test web pages displayed in embedded browsers, you must have an active license for the TestComplete Web module. The Desktop module is not required.

Common Considerations for Testing with Embedded Web Browsers

When testing in any embedded browser, take the following into account:

  • An application is recognized as an "ordinary" Process test object (rather than the Browser test object).

  • Page objects may be not immediate children of the respective process. They can be child objects of the window object that hosts the browser control.

  • Web tests created in applications with embedded browsers are not cross-browser tests (as they depend on the position of the embedded browser control within the object hierarchy). That is, for the same web page displayed in a standard and in an embedded browser, the path to the Page object varies, while the child objects are the same.

  • To add an application with an embedded browser as a Tested Application, you should add it as a Generic Windows Tested Application (rather than as a Web Application).

Specifics of Testing Applications with the Embedded Chromium Browser
  • For CEF-based applications: TestComplete can expose the page hierarchy only if JavaScript is enabled in the application. Enable JavaScript in your tested application through the settings of the CEF library.

  • Testing of Silverlight applications in CEF-based applications is not currently supported.

  • The hierarchy of web page elements in CEF-based and Electron-based applications is displayed as the Tree object model. If some other object model is chosen (not recommended), it is treated as the Tree model.

  • To test web applications created with EO.WebBrowser, set your system DPI to 100%.

See Also

Classic Web Testing
Preparing Web Browsers
Requirements for Web Testing
Possible Issues With Web Testing

Highlight search results