Web Add-in Extensibility Developer Guide > Web Add-in Extensibility API reference > Mercury.QTP.ToolkitManager Namespace > _util Class > _util Class Methods > GetBrowserType Method

_util.GetBrowserType Method

Returns the name of the browser that is currently running the control.

Syntax

JScript 
public function GetBrowserType() : String;

Return Value

A string value. Possible values: 

  • Mozilla Firefox 
  • internet explorer
  • Chrome

Note: These strings are defined as QtpConstants.FireFox, QtpConstants.IE, and QtpConstants.Chrome in the common.js file.

Example

The JavaScript excerpt below is from a function that performs the Select test object operation on a custom menu control. It uses the mouseover event to perform the selection. However, when running on Mozilla Firefox, it also has to send a click event.

{
...
   window.$(item).simulate("mouseover");
   if (_util.GetBrowserType() == QtpConstants.FireFox)
      window.$(item).simulate("click");
   menuItem = item;
   _util.Report(micDone, "Select", toSafeArray(new Array(Path)), "Selected " + Path);

}