Creating Cross Browser Tests

Applies to TestComplete 14.80, last modified on April 13, 2021

This topic provides an overview of cross-browser test development with TestComplete. It includes the following sections:

General Procedure

Creation of cross-browser web tests with TestComplete is very similar to creating single-browser web tests: you use the same test commands to simulate user actions with web page elements, create checkpoints, run the browser, and so on. So, when we are speaking about cross-browser test creation, we are speaking more about methodology rather than test commands used.

Creation of cross-browser tests typically includes the following steps:

  1. Prepare your test project and web browsers for testing.

    • In the project, set the Tree value for the Web tree model setting and disable the Use legacy web testing features setting. See Requirements for Web Testing.

    • Web browsers also require configuration. Please follow the instructions that are mentioned in Preparing Web Browsers. Although most of TestComplete web testing features are browser-independent, browsers demonstrate different behavior in some cases. Preparing browsers in the appropriate way decreases the number of differences and simplifies creation of automated web tests.

  2. Record or create a test in one browser.

    The easiest way to create web tests is to record them. For detailed information about this, see Creating and Recording Web Tests.

    After you recorded the test, modify it if necessary (for instance, insert needed checkpoints), and then make sure that the test runs successfully on the browser that you used for recording.

  3. Check if the test runs on another browser.

    Select another browser for the run and check whether the test runs successfully in it. If necessary, change the test so that it takes into account the specifics of the new browser. See Handling Browser Differences.

  4. Verify that the test is still playable for the previous browser.

    In general, the changes you made to the test in the previous step can break the test for the previous browser. So, after you made all changes, run the test for the previous browser to ensure that it works successfully with it.

  5. Repeat steps 3-4 for every browser you need.

Cross-Browser Testing Tips

  • Launch the tested browser using the Browser Loop or the Run Browser keyword-test operations or the Browsers.Item(...).Run method.

    If you need to start your test in a running browser, use the Navigate operation or the Browsers.CurrentBrowser.Navigate method.

    These operations and methods are recommended ways to start browsers and open start pages for tests. Using other means may cause issues with creating cross-browser tests.

  • To access data of a web page element, use the contentText property. Do not use browser-specific properties like innerText in Internet Explorer and Edge, or textContent in Firefox and Chrome.

    To access the document object, use the Page(...).contentDocument property.

  • If your test uses data of element attributes, for instance, if it checks attribute values, pay attention to that data. Different browsers return attribute values in different formats. For example, Internet Explorer returns the value of a Color attribute as #ffaa00, while Firefox and Chrome return it as rgb(255,170,00). Even different versions of the same browser may return attribute values in different formats.

For more information on handling browser-specific behavior, see Handling Browser Differences.

More Information on Web Test Creation

To learn more about ... See these topics ...
Performing typical actions in TestComplete web tests like launching browsers, finding elements on pages, and so on How To
Quick tips on performing typical web testing tasks, line checking for broken links, validating page structure and others Web Testing - Examples
Creating checkpoints in tests About Checkpoints
Parameterizing tests with external data Data-Driven Testing

See Also

About Cross-Browser Testing in TestComplete
Handling Browser Differences
Creating and Recording Web Tests

Highlight search results