Browser

Web. Browser

new Browser()

Methods

attach(filter) → {Promise.<Web.BrowserTO>}

Returns a new browser instance that is attached to a browser tab that was not opened by UFT Developer (for example, a browser tab that was opened manually or by the AUT).
Web.BrowserFilter is used only when attaching to the browser so transient properties like Web.BrowserFilter.url and Web.BrowserFilter.title can be used.
UFT Developer recognizes browser windows and tabs that it opens (for example, via Web.Browser.launch). If a browser is opened outside of the UFT Developer context, you need to use the Web.Browser.attach method to acquire the browser tab or window. For example:
- A browser tab was opened manually while setting up a scenario prior to running a UFT Developer test.
- A test step clicks a link in the AUT that opens a new or replacement browser tab or window.
Parameters:
NameTypeDescription
filterWeb.BrowserFilterThe browser filter object, or property bag which contains the browser filter properties.
Example: Web.Browser.attach({type: "Chrome"}).then(function (b) { browser = b; ... });
Returns:
a promise that is fulfilled with the requested browser or rejected with the relevant error.
Type
Promise.<Web.BrowserTO>

launch(browserType) → {Promise.<Web.BrowserTO>}

Launches a new browser tab returning an instance of Web.Browser for the launched browser. The returned browser instance is valid until the tab is closed.
Parameters:
NameTypeDescription
browserTypestringThe type of browser to launch: Possible values: Web.BrowserType
Returns:
a promise that is fulfilled with the browser instance.
Type
Promise.<Web.BrowserTO>

launchDevice(browserType, device) → {Promise.<Web.BrowserTO>}

Launched a new browser on the passed device returning an instance of Web.BrowserTO for the launched browser.
Parameters:
NameTypeDescription
browserTypestringThe type of browser to launch: Possible values: Web.BrowserType. Note: not all devices support all browser types.
deviceDeviceTOthe device to launch the browser on.
Returns:
a promise that is fulfilled with the browser instance.
Type
Promise.<Web.BrowserTO>

launchEmulated(browserType, emulatedDeviceopt) → {Promise.<Web.BrowserTO>}

Launches a new browser on emulated device returning an instance of Web.BrowserTO for the launched browser. The returned browser instance is valid until the tab is closed.
Parameters:
NameTypeAttributesDescription
browserTypestringThe type of browser to launch: Possible values: Web.BrowserType
emulatedDeviceObject | string <optional>
The emulated device object (see members below) or the name of predefined emulated device as it appears in Chrome e.g. "iPhone 6" or "Nexus 6P"
Note: the predefined devices are "Galaxy S5","Nexus 5X","Nexus 6P","iPhone 5","iPhone 6","iPhone 6 Plus","iPad".
Properties
NameTypeAttributesDefaultDescription
namestring <optional>
The name of the emulated device.
heightnumber <optional>
The height of the emulated device screen.
widthnumber <optional>
The width of the emulated device screen.
isTouchableboolean <optional>
true The touchable capability of the emulated device screen.
scaleFactornumber <optional>
The scale factor of the emulated device screen.
userAgentstring <optional>
The UserAgent property of the emulated device.
isMobileboolean <optional>
true The mobile property of the emulated device.
Returns:
a promise that is fulfilled with the browser instance.
Type
Promise.<Web.BrowserTO>

openedBrowsers(filter) → {Promise.<Array.<Web.BrowserTO>>}

Returns a collection of all open Web.Browser instances that match the Web.BrowserFilter.
Web.BrowserFilter is used only when attaching to the browser so transient properties like Web.BrowserFilter.url and Web.BrowserFilter.title can be used.
UFT Developer recognizes browser windows and tabs that it opens (for example, via Web.Browser.launch). If a browser is opened outside of the UFT Developer context, you need to use the Web.Browser.attach method to acquire the browser tab or window.
For example:
- A browser tab was opened manually while setting up a scenario prior to running a UFT Developer test.
- A test step clicks a link in the AUT that opens a new or replacement browser tab or window.
Parameters:
NameTypeDescription
filterWeb.BrowserFilterThe browser filter object, or property bag which contains the browser filter properties.
Example: Web.Browser.openedBrowsers({type: "Chrome"}).then(function (blist) { list = blist; ... });
Returns:
a promise that is fulfilled with an array of all the requested browsers.
Type
Promise.<Array.<Web.BrowserTO>>