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.
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, optionsopt) → {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.
If the
Incognito/private mode is only supported for Chrome, Firefox, and Edge desktop browsers.
The browser agent extension needs to be allowed to run in incognito mode.
If the
Profile support is only available for Chrome, Firefox, and Edge desktop browsers.
For Firefox, use the profile name as shown in Firefox's Profile Manager.
For Chrome and Edge, use the profile folder name found in the Local AppData directory.
The browser agent extension needs to be activated on each profile used.
Note: You cannot use
If the
incognito flag is set to true, the browser is launched in incognito/private mode.
Incognito/private mode is only supported for Chrome, Firefox, and Edge desktop browsers.
The browser agent extension needs to be allowed to run in incognito mode.
If the
profileName option is specified, the browser is launched with the specified user profile.
Profile support is only available for Chrome, Firefox, and Edge desktop browsers.
For Firefox, use the profile name as shown in Firefox's Profile Manager.
For Chrome and Edge, use the profile folder name found in the Local AppData directory.
The browser agent extension needs to be activated on each profile used.
Note: You cannot use
profileName when incognito mode is enabled.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
browserType |
string | The type of browser to launch. Possible values: Web.BrowserType | |||||||||||||
options |
Object |
<optional> |
The optional launch options for the browser.
Properties
|
Throws:
-
If incognito mode is enabled and a profile name is also specified.
- Type
- Error
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
|
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.
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>>