Connect to Device Lab and Launch Web Browser

Applies to TestComplete 15.40, last modified on March 25, 2022

The information in this topic applies to cross-platform web tests. To learn how to launch web browsers on your local computer, see Launch Web Browsers.

In TestComplete, you can create cross-platform web tests that you can run in a wide range of web browsers, including those that TestComplete does not support directly, running on various desktop and mobile platforms including Windows, Linux, Unix, Mac OS, and mobile iOS and Android.

TestComplete runs these tests by connecting to remote environments in a device cloud and executing test commands there. Each test starts with connecting to a remote environment and launching a web browser instance.

Prerequisites

Create a cross-platform compatible web tests as described in Creating and Running Cross-Platform Web Tests.

Requirements

You must have access to a device cloud. It can be:

  • A private hub managed by Selenium Grid.

  • A cloud provided as a service by a third-party provider, for instance CrossBrowserTesting.com.

If you use a SmartBear device cloud

You connect to a SmartBear device cloud and launch a web browser there in your test by using one of the following:

Using the Run Remote Browser operation

  1. Add the Run Remote Browser operation to your keyword web test.

  2. In the operation parameters dialog, sign in to your device cloud account (if required). If you still do not have an account, you can sign up for a free trial directly from the dialog.

    The account information will be saved to your project. It will be used whenever you call the dialog again. You can view and modify the information on the Device Cloud - Web or Device Cloud - General page of your project.

  3. Specify the URL of your tested web application or website.

  4. Select a platform and a web browser that you want to launch and in which you want to run your web test.

Connecting to the CrossBrowserTesting device cloud and launching a web browser from a TestComplete keyword test

Click the image to enlarge it.

When you run your test, the operation will connect to the specified server using the provided credentials and launch the specified browser instance there.

Using the Browsers.RemoteItem.Run method

  1. In Code Editor, click on the toolbar.

  2. In the resulting Generate Run Code dialog, sign in to your device cloud account (if required). If you still do not have an account, you can sign up for a free trial directly from the dialog.

    The account information will be saved to your project. It will be used whenever you call the dialog again. You can view and modify the information on the Device Cloud - Web or Device Cloud - General page of your project.

  3. Specify the URL of your tested web application or website.

  4. Select the platform and the web browser that you want to launch and in which you want to run your web test.

  5. The dialog will generate the code that will connect to the device cloud and launch the needed browser there.

  6. Copy the generated code to the clipboard and then paste it to the needed place in your script.

Connecting to the CrossBrowserTesting device cloud and launching a web browser from a TestComplete script test

Click the image to enlarge it.

When you run your test, the code will connect to the specified server using the provided credentials and launch the specified browser instance there.

If you use any other Selenium Grid provider

In Scripts

  1. Create an object that describes the needed web browser. Use the capabilities that your Selenium Grid provider supports. To learn which capabilities your Selenium Grid provider supports, please see your provider documentation.

  2. Use the Browsers.RemoteItem(server, capabilities).Run method to run the needed web browser, where server is the URL of your Selenium Hub and capabilities is the created object that describes the needed web browser.

In Keyword Tests

Create a script that runs the Browsers.RemoteItem.Run method as described above. Call the script from your keyword tests by using the Run Code Snippet or Run Script Routine operation.

See Also

How To
About Cross-Platform Web Tests
Project Properties - Web Option

Highlight search results