_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

These strings are defined in the common.js file as follows:

  • QtpConstants.FireFox
  • QtpConstants.IE
  • QtpConstants.Chrome 

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.uft.$(item).simulate("mouseover");
   if (_util.GetBrowserType() == QtpConstants.FireFox)
      window._uft.$(item).simulate("click");
   menuItem = item;
   _util.Report(micDone, "Select", toSafeArray(new Array(Path)), "Selected " + Path);

}

Note: UFT 14.50 and earlier

If you are developing your toolkit using a UFT version of 14.50 or earlier, call the jQuery library using only $ instead of _uft.$.

If errors occur due to conflicting jQuery libraries, we recommend you upgrade your toolkit using UFT 14.51 or later.