VirtualBrowsers.Item Property

Applies to TestComplete 15.45, last modified on December 01, 2022

Description

The VirtualBrowsers.Item property returns a mobile browser profile by its name or index. The returned VirtualBrowserInfo object contains information about the browser profile (user agent, screen size and so on) and lets you launch the mobile browser emulator with this profile.

Declaration

VirtualBrowsers.Item(NameOrIndex)

Read-Only Property A VirtualBrowserInfo object.
NameOrIndex [in]    Required    Variant    

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

NameOrIndex

One of the following:

  • A string with the name of the browser profile. For example, "Apple iPad". For possible values, check the project’s Virtual Browsers properties.

  • The position (starting from 0) of the browser profile in the project’s Virtual Browsers properties. Note that only the enabled profiles are taken into account.

Property Value

The VirtualBrowserInfo object that corresponds to the mobile browser profile with the specified name or index.

If the specified browser profile is disabled (it is unchecked in the project’s Virtual Browsers properties), an error is posted to the test log. An error is also logged if there is no browser profile with the specified name or index.

Remarks

The VirtualBrowsers object provides access only to the enabled browser profiles (those that are checked in the project’s Virtual Browsers properties). The disabled profiles cannot be accessed via the VirtualBrowsers object.

Example

This following code launches the iPad browser emulator with an URL:

JavaScript, JScript

VirtualBrowsers.Item("Apple iPad").Run("http://m.smartbear.com");

Python

VirtualBrowsers.Item["Apple iPad"].Run("http://m.smartbear.com");

VBScript

Call VirtualBrowsers.Item("Apple iPad").Run("http://m.smartbear.com")

DelphiScript

VirtualBrowsers.Item['Apple iPad'].Run('http://m.smartbear.com');

C++Script, C#Script

VirtualBrowsers["Item"]("Apple iPad")["Run"]("http://m.smartbear.com");

See Also

Testing Mobile Web Applications Using Emulator
VirtualBrowsers Object
VirtualBrowsers.Count
VirtualBrowsers.CurrentBrowser
VirtualBrowserInfo Object

Highlight search results