GetBrowserType Function

Action

Returns the current browser type.

Availability

This functionality is supported only if you are using the Classic Agent. For additional information, refer to the Silk Test Classic Classic Agent Help.

Syntax

Note: When you are using the Open Agent, you can get the browser type by using the GetProperty method of the AnyWin class on the browser application. For example:
browserApplication.getProperty("browsertype")
BrowserType = GetBrowserType ([hMachine])
Variable Description
BrowserType The current browser type. BROWSERTYPE.
hMachine Optional: The handle for a specific machine. Default is the current machine. HMACHINE.

Notes

If the current browser has been set in a script with the SetBrowserType function, GetBrowserType returns that browser type for the current machine or for the specified machine if the optional argument is used.

If the current browser has not been set in a script, GetBrowserType returns the BROWSERTYPE set for Default Browser in Runtime Options; if no browser is specified in Runtime Options, GetBrowserType returns NULL.

Note: When you are using the Open Agent, you can get the browser type by using the GetProperty method of the AnyWin class on the browser application. For example:
browserApplication.getProperty("browsertype")

Example

BROWSERTYPE btType
btType = GetBrowserType ()
Print ("Browser is {btType}")

// Result if Explorer 7.0 is current browser:
// Browser is Internet Explorer 7.0