OpenText™ Functional Testing for Developers JavaScript SDK

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 OpenText Functional Testing for Developers (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.
OpenText Functional Testing for Developers recognizes browser windows and tabs that it opens (for example, via Web.Browser.launch). If a browser is opened outside of the OpenText Functional Testing for Developers 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 test.
- A test step clicks a link in the AUT that opens a new or replacement browser tab or window.
Parameters:
Name Type Description
filter Web.BrowserFilter The 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:
Name Type Description
browserType string The 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:
Name Type Description
browserType string The type of browser to launch: Possible values: Web.BrowserType. Note: not all devices support all browser types.
device DeviceTO the 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:
Name Type Attributes Description
browserType string The type of browser to launch: Possible values: Web.BrowserType
emulatedDevice Object | 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
Name Type Attributes Default Description
name string <optional>
The name of the emulated device.
height number <optional>
The height of the emulated device screen.
width number <optional>
The width of the emulated device screen.
isTouchable boolean <optional>
true The touchable capability of the emulated device screen.
scaleFactor number <optional>
The scale factor of the emulated device screen.
userAgent string <optional>
The UserAgent property of the emulated device.
isMobile boolean <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.
OpenText Functional Testing for Developers recognizes browser windows and tabs that it opens (for example, via Web.Browser.launch). If a browser is opened outside of the OpenText Functional Testing for Developers 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 test.
- A test step clicks a link in the AUT that opens a new or replacement browser tab or window.
Parameters:
Name Type Description
filter Web.BrowserFilter The 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>>