WebUtil Object
Description
Enables you to set or modify Web related settings.
Associated Methods
AddCookie | Adds a cookie to the test transaction file. |
AttachRemoteDebugging | Enables UFT One to access an application containing Chromium-based Frameworks or Microsoft Edge WebView2 controls through a specific address and port during a run session. |
DeleteCookie | Deletes a cookie from the cookie table. |
DeleteCookies | Deletes all cookies for the browser being used in the test run. |
DetachRemoteDebugging | Stops the connection to an application containing Chromium Embedded Frame and Electron controls or Microsoft Edge WebView2 controls during a run session. |
GetCookies | Retrieves the list of cookies for the browser being used in the testtransaction file run. |
LaunchBrowser | Launches a browser based on the specific parameters. |
LaunchMobileBrowserWithID | Launches a mobile browser on a device using the Digital Lab's device ID. |
AddCookie Method
Description
Adds a cookie to the test transaction file.
IMPORTANT
This method is supported for Internet Explorer browsers only.
Syntax
WebUtil.AddCookiedomain, cookies
Argument | Type | Description |
---|---|---|
domain | String | The name of the domain that the host uses. |
cookies | String | The cookie information in the format:
|
In the following example, a cookie is inserted into the test transaction file.
WebUtil.AddCookie "www.dummy.com", "MyCookie=12345678; expires=Wdy, 22-Dec-2001 00:00:00 GMT; domain=.dummy.com; path=/ ;secure"
In the following example, a cookie is erased from the test transaction file by inserting an expired date into the method.
WebUtil.AddCookie "www.dummy.com", "MyCookie=12345678; expires=Wdy, 22-Dec-1999 00:00:00 GMT; domain=.dummy.com; path=/ ;secure"
AttachRemoteDebugging Method
Description
Enables UFT One to access an application containing Chromium-based frameworks or Microsoft Edge WebView2 controls through a specific address and port during a run session.
Syntax
WebUtil.AttachRemoteDebugging URL:port, [Mode], [WebDriverPath]
Argument | Type | Description |
---|---|---|
URL:port | String | The address of the application and the port number used to access it. The port number is the Chrome remote debugging port number configured in your application. |
Mode | String | Optional. Specifies whether to use the NW.js ChromeDriver or UFT One's default ChromeDriver, which is relevant for CEF, Electron, or JxBrowser framework objects. Possible values:
|
WebDriverPath | String | Optional. The path to a specific ChromeDriver to use when testing the specified application. When provided, UFT One uses this driver instead of the default drivers normally associated with the specified Mode. |
The following example accesses an application containing Chromium Embedded Frame and Electron framework objects, and uses a specified ChromeDriver:
WebUtil.AttachRemoteDebugging "127.0.0.1:8822", "default", “C:\MyBrowserDrivers\cef\chromedriver.exe”
The following example accesses an application containing NW.js framework objects, using the chromedriver.exe from the default nw.js location:
WebUtil.AttachRemoteDebugging "127.0.0.1:8822", "nw.js"
DeleteCookie Method
Description
Deletes a cookie from the cookie table.
IMPORTANT
This method is supported for Internet Explorer browsers only.
Syntax
WebUtil.DeleteCookiedomain, cookies
Argument | Type | Description |
---|---|---|
domain | String | Name of the domain that the host uses. |
cookies | String | The cookie information in the format:
|
The following example deletes the second cookie from the table.
WebUtil.DeleteCookie "www.dummy.com", "SecondCookie"
DeleteCookies Method
Description
Deletes all cookies for the browser being used in the test run.
IMPORTANT
This method is supported for Internet Explorer browsers only.
Syntax
WebUtil.DeleteCookies
The following statement deletes all of the cookies from the cookie table.
WebUtil.DeleteCookies
DetachRemoteDebugging Method
Description
Stops the connection to an application containing Chromium-based framework controls or Microsoft Edge WebView2 controls during a run session.
Syntax
WebUtil.DetachRemoteDebugging URL:port
Argument | Type | Description |
---|---|---|
URL:port | String | The address of the application and the port number used to access it. The port number is the Chrome remote debugging port number configured in your application. |
The following example accesses an application containing Chromium-based framework objects
WebUtil.DetachRemoteDebugging "127.0.0.1:8822"
GetCookies Method
Description
Retrieves the list of cookies for the browser being used in the test transaction file run.
IMPORTANT
This method is supported for Internet Explorer browsers only.
Syntax
WebUtil.GetCookieURL
Argument | Type | Description |
---|---|---|
URL | String | The URL of the site from which to return the cookies. This URL must contain http:// to return the cookies for the selected site. |
Return Value
A list of all cookies for the site
The following example retrieves the cookie list and prints a message.
Dim CookiesList
CookiesList = WebUtil.GetCookies "www.dummy.com"
MsgBox("CookiesList contains" & CookiesList)
LaunchBrowser Method
Description
Launches a browser based on the specific parameters.
IMPORTANT
Use this method to set a device only before any additional browser steps. Using this method after already having set a device may produce unexpected results.
For example, use this method as follows:
WebUtil.LaunchBrowser "MOBILE_CHROME", "lT-1", "cube", "ANDROID", "5.1" Browser("Nested Lists").Page("Page").WebEdit("Name").Set "MyName" Browser("Nested Lists").Page("Page").WebEdit("Name").CheckProperty "value", "MyName"
Workaround: To switch devices in the middle of your test, use the Browser Object methods. For example:
Device("Device").App("identifier:==MC.Browser","instrumented:=false").Launch DoNotInstall, Restart Browser("Device1").Page("Page").WebEdit("Name").Set "MyName" Browser("Device2").Page("Page").WebEdit("Name").Set "MyName"
Syntax
WebUtil.LaunchBrowserBrowser, [device_model, device_manufacturer, device_ostype, device_osversion, device_source]
Argument | Type | Description |
---|---|---|
Browser | String | Required. The name of the browser to launch. Possible values:
|
device_model | String | Optional. The model of the selected device containing the browser. Do not use this parameter when launching browsers on a desktop. Device model values must be identical to device names listed in the Device section in the Digital Lab Wizard. When working with the Chrome emulator, you can modify the Device names in the EmulatedDevices.xml file. For details, see the UFT One Help Center. |
device_manufacturer | String | Optional. The manufacturer of the specific device. This parameter should not be used when launching browsers on a desktop. |
device_ostype | String | Optional. The operating system running on the specified device. This parameter should not be used when launching browsers on a desktop. One of the following:
Mandatory if the Browser value is set to MOBILE_CHROME, MOBILE_SAFARI, or MOBILE_HPEWEB. |
device_osversion | String | Optional. The operating system version running on the specified device. This parameter should not be used when launching browsers on a desktop. |
device_source | String | Optional. The source of the device containing the browser. This parameter should not be used when launching browsers on a desktop. Possible values:
|
Return Value
None
The following example launches Firefox on a desktop:
WebUtil.LaunchBrowser "FIREFOX"
The following example launches the Chrome browser on an Android device:
WebUtil.LaunchBrowser "MOBILE_CHROME", "lT-1", "cube", "ANDROID", "5.1"
The following example launches the Chrome browser on an Android device stored on an AWS Device Farm:
WebUtil.LaunchBrowser "MOBILE_CHROME", "", "", "ANDROID", "", "AWS"
The following example launches the Chrome Emulator browser on an iPhone X device:
WebUtil.LaunchBrowser "CHROME_EMULATOR", "iPhone X"
LaunchMobileBrowserWithID Method
Description
Launches a mobile browser on a device using the Digital Lab's device ID.
IMPORTANT
Use this method to set a device only before any additional browser steps. Using this method after already having set a device may produce unexpected results.
For example, use this method as follows:
WebUtil.LaunchMobileBrowserWithID "MOBILE_CHROME", "ANDROID", "03" Browser("Nested Lists").Page("Page").WebEdit("Name").Set "MyName" Browser("Nested Lists").Page("Page").WebEdit("Name").CheckProperty "value", "MyName
Workaround: To switch devices in the middle of your test, use the Device Object methods. For example:
Browser("Device1").Page("Page").WebEdit("Name").Set "MyName" Browser("Device2").Page("Page").WebEdit("Name").Set "MyName"
Syntax
WebUtil.LaunchMobileBrowserWithIDBrowser, device_ostype, device_id
Argument | Type | Description |
---|---|---|
Browser | String | Required. The name of the browser to launch. Possible values:
|
device_ostype | String | Required. The operating system running on the specified device. One of the following:
|
device_id | String | Required. The id property assigned to the device by Digital Lab. |
Return Value
None
See also:
- Crypt Object
- DataTable Object
- Description Object
- DeviceReplay Object
- DotNetFactory Object
- DTParameter Object
- DTSheet Object
- Environment Object
- Extern Object
- Parameter Object
- JSON Object
- JsonUtil Object
- MercuryTimers Object (Collection)
- MercuryTimer Object
- NV Object
- OptionalStep Object
- ParallelUtil Object
- LocalParameter Object
- PasswordUtil Object
- PathFinder Object
- PDFUtil Object
- Properties Object (Collection)
- QCUtil Object
- RandomNumber Object
- Recovery Object
- Remote Connection Object
- Reporter Object
- RepositoriesCollection Object
- Repository Object
- Services Object
- Setting Object
- SystemMonitor Object
- TestArgs Object
- TextUtil Object
- UIAutomation Object
- VisualRelation Object
- VisualRelations Object
- VisualRelationsCollection Object
- WebUtil Object
- XMLUtil Object