Convert an array of names of browsers, to a List of {@link SupportedBrowser}s.
190651
public static List<SupportedBrowser> toSupportedBrowsers(String[] browserNames) {
		List<SupportedBrowser> browsers = new ArrayList<>();
		for (String browserName : browserNames) {
			SupportedBrowser browser = SupportedBrowser.valueOf(browserName.toUpperCase());
			if(!browsers.contains(browser))
				browsers.add(browser);
		}
		return browsers;
	}
668423
private static boolean openBrowserJava6(String url) throws Exception {
        final Class<?> desktopClass;
        try {
            desktopClass = Class.forName("java.awt.Desktop");
        } catch (ClassNotFoundException e) {
            return false;
        }
        Boolean supported = (Boolean) desktopClass.getMethod("isDesktopSupported", new Class[0]).invoke(null);
        if (supported) {
            Object desktop = desktopClass.getMethod("getDesktop", new Class[0]).invoke(null);
            desktopClass.getMethod("browse", new Class[]{URI.class}).invoke(desktop, new URI(url));
            return true;
        }
        return false;
    }
1032076
private static Browser parseBrowser(String userAgentString) {
		for (Browser brower : Browser.browers) {
			if (brower.isMatch(userAgentString)) {
				return brower;
			}
		}
		return Browser.Unknown;
	}
47413
private static List<String> gridBrowsers(Map<String, String> filter) {

        ArrayList<String> response = new ArrayList<String>();
        LOGGER.debug("Trying to get a list of Selenium-available browsers");

        String grid = System.getProperty("SELENIUM_GRID");

        if (grid != null) {
            grid = "http://" + grid + "/grid/console";
            Document doc;
            try {
                doc = Jsoup.connect(grid).timeout(DEFAULT_TIMEOUT).get();
            } catch (IOException e) {
                LOGGER.debug("Exception on connecting to Selenium grid: {}", e.getMessage());
                return response;
            }

            Elements slaves = (Elements) doc.select("div.proxy");

            for (Element slave : slaves) {
                String slaveStatus = slave.select("p.proxyname").first().text();
                if (!slaveStatus.contains("Connection") && !slaveStatus.contains("Conexión")) {
                    Integer iBusy = 0;
                    Elements browserList = slave.select("div.content_detail").select("*[title]");
                    Elements busyBrowserList = slave.select("div.content_detail").select("p > .busy");
                    for (Element browserDetails : browserList) {
                        if (browserDetails.attr("title").startsWith("{")) {
                            boolean filterCheck = true;
                            for (Map.Entry<String, String> f : filter.entrySet()) {
                                String stringFilter = f.getKey() + "=" + f.getValue() + "[,|}]";
                                Pattern patFilter = Pattern.compile(stringFilter);
                                Matcher mFilter = patFilter.matcher(browserDetails.attr("title"));
                                filterCheck = filterCheck & mFilter.find();
                            }
                            if (filterCheck) {
                                Pattern pat = Pattern.compile("browserName=(.*?),.*?(version=(.*?)[,|}])");
                                Matcher m = pat.matcher(browserDetails.attr("title"));
                                while (m.find()) {
                                    String browser = m.group(1) + "_" + m.group(3);
                                    if (browser.equals(System.getProperty("FORCE_BROWSER"))) {
                                        response.add(browser);
                                    }
                                }
                            }
                        } else {
                            String version = busyBrowserList.get(iBusy).parent().text();
                            String browser = busyBrowserList.get(iBusy).text();
                            version = version.substring(2);
                            version = version.replace(browser, "");
                            String browserSrc = busyBrowserList.get(iBusy).select("img").attr("src");
                            if (!browserSrc.equals("")) {
                                browser = browserSrc.substring(browserSrc.lastIndexOf('/') + 1, browserSrc.length()
                                        - DEFAULT_LESS_LENGTH);
                            }
                            response.add(browser + "_" + version);
                            iBusy++;
                        }
                    }
                }
            }
        }
        // Sort response
        Collections.sort(response);
        return response;
    }
1243739
static String[] getUsable(final List<String> available, final String[] supported)
    {
        final List<String> filtered = new ArrayList<String>(available.size());
        final List<String> supportedList = Arrays.asList(supported);

        for (final String s : available)
        {
            if (supportedList.contains(s)) filtered.add(s);
        }

        final String[] filteredArray = new String[filtered.size()];
        filtered.toArray(filteredArray);
        return filteredArray;
    }
1204455
function (param, allowTypes) {
    var t$ = Tool;
    allowTypes = allowTypes || [];
    if (t$.isUndefinedOrNull(param)) { return [] }
    if (allowTypes.findIndex(function (value, index, err) {
      return value === t$.getType(param)
    }) > -1) {
      return [param]
    }
    if (t$.isArray(param)) { return param }
    return []
  }
392229
function configureLocalBrowsers (config) {
  var isMac = /^darwin/.test(process.platform);
  var isWindows = /^win/.test(process.platform);
  var isLinux = !isMac && !isWindows;

  if (isMac) {
    config.browsers = ['Firefox', 'Chrome', 'Safari'];
  }
  else if (isLinux) {
    config.browsers = ['Firefox', 'ChromeHeadless'];
  }
  else if (isWindows) {
    config.browsers = ['Firefox', 'Chrome', 'IE9', 'IE10', 'IE'];

    // NOTE: IE 6, 7, 8 are not supported by Chai
    config.customLaunchers = {
      IE9: {
        base: 'IE',
        'x-ua-compatible': 'IE=EmulateIE9'
      },
      IE10: {
        base: 'IE',
        'x-ua-compatible': 'IE=EmulateIE10'
      }
    };
  }
}
790915
@DataProvider(parallel = true)
    public static Iterator<String[]> availableUniqueBrowsers(ITestContext context, Constructor<?> testConstructor)
            throws Exception {

        Map<String, String> map = new HashMap<String, String>();
        List<String> browsers = gridBrowsers(map);

        HashSet<String> hs = new HashSet<String>();
        hs.addAll(browsers);
        browsers.clear();
        browsers.addAll(hs);

        return buildIterator(browsers);
    }
284354
function (browserName, config) {
    var longName = null;
    if(this.browsers.hasOwnProperty(browserName)){
      longName = this.browsers[browserName].longName;
    }
    if(config.get('browsers')[0].hasOwnProperty(browserName)){
      longName = config.get('browsers')[0][browserName].longName;
    }
    return longName;
  }
101308
private static List<TypeName> convert(List<? extends TypeMirror> input) {
		List<TypeName> result = new ArrayList<TypeName>();

		for (TypeMirror item : input) {
			result.add(TypeUtility.typeName(item));
		}

		return result;
	}
594958
public function usedBrowsers()
    {
        $results = [];

        foreach ($this->views as $view) {
            array_key_exists($view->browser, $results) ? $results[$view->browser]++ : $results[$view->browser] = 1;
        }

        return $results;
    }
875834
public static Collection<String> getConversionProviderNames(){
        Collection<String> providers = getMonetaryConversionsSpi().getProviderNames();
        if(Objects.isNull(providers)){
            Logger.getLogger(MonetaryConversions.class.getName()).warning(
                    "No supported rate/conversion providers returned by SPI: " +
                            getMonetaryConversionsSpi().getClass().getName());
            return Collections.emptySet();
        }
        return providers;
    }
1227925
public static String getBrowser() {
        String browser = getProgramProperty(BROWSER);
        if (browser == null || "".equals(browser)) {
            browser = Browser.BrowserName.HTMLUNIT.toString();
        }
        return browser;
    }
841774
function getBrowserInfo() {
    var nVer = navigator.appVersion;
    var nAgt = navigator.userAgent;
    var browserName = navigator.appName;
    var fullVersion = '' + parseFloat(navigator.appVersion);
    var majorVersion = parseInt(navigator.appVersion, 10);
    var nameOffset, verOffset, ix;

    // In Opera, the true version is after 'Opera' or after 'Version'
    if (isOpera) {
        browserName = 'Opera';
        try {
            fullVersion = navigator.userAgent.split('OPR/')[1].split(' ')[0];
            majorVersion = fullVersion.split('.')[0];
        } catch (e) {
            fullVersion = '0.0.0.0';
            majorVersion = 0;
        }
    }
    // In MSIE version <=10, the true version is after 'MSIE' in userAgent
    // In IE 11, look for the string after 'rv:'
    else if (isIE) {
        verOffset = nAgt.indexOf('rv:');
        if (verOffset > 0) { //IE 11
            fullVersion = nAgt.substring(verOffset + 3);
        } else { //IE 10 or earlier
            verOffset = nAgt.indexOf('MSIE');
            fullVersion = nAgt.substring(verOffset + 5);
        }
        browserName = 'IE';
    }
    // In Chrome, the true version is after 'Chrome' 
    else if (isChrome) {
        verOffset = nAgt.indexOf('Chrome');
        browserName = 'Chrome';
        fullVersion = nAgt.substring(verOffset + 7);
    }
    // In Safari, the true version is after 'Safari' or after 'Version' 
    else if (isSafari) {
        // both and safri and chrome has same userAgent
        if (nAgt.indexOf('CriOS') !== -1) {
            verOffset = nAgt.indexOf('CriOS');
            browserName = 'Chrome';
            fullVersion = nAgt.substring(verOffset + 6);
        } else if (nAgt.indexOf('FxiOS') !== -1) {
            verOffset = nAgt.indexOf('FxiOS');
            browserName = 'Firefox';
            fullVersion = nAgt.substring(verOffset + 6);
        } else {
            verOffset = nAgt.indexOf('Safari');

            browserName = 'Safari';
            fullVersion = nAgt.substring(verOffset + 7);

            if ((verOffset = nAgt.indexOf('Version')) !== -1) {
                fullVersion = nAgt.substring(verOffset + 8);
            }

            if (navigator.userAgent.indexOf('Version/') !== -1) {
                fullVersion = navigator.userAgent.split('Version/')[1].split(' ')[0];
            }
        }
    }
    // In Firefox, the true version is after 'Firefox' 
    else if (isFirefox) {
        verOffset = nAgt.indexOf('Firefox');
        browserName = 'Firefox';
        fullVersion = nAgt.substring(verOffset + 8);
    }

    // In most other browsers, 'name/version' is at the end of userAgent 
    else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < (verOffset = nAgt.lastIndexOf('/'))) {
        browserName = nAgt.substring(nameOffset, verOffset);
        fullVersion = nAgt.substring(verOffset + 1);

        if (browserName.toLowerCase() === browserName.toUpperCase()) {
            browserName = navigator.appName;
        }
    }

    if (isEdge) {
        browserName = 'Edge';
        fullVersion = navigator.userAgent.split('Edge/')[1];
        // fullVersion = parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10).toString();
    }

    // trim the fullVersion string at semicolon/space/bracket if present
    if ((ix = fullVersion.search(/[; \)]/)) !== -1) {
        fullVersion = fullVersion.substring(0, ix);
    }

    majorVersion = parseInt('' + fullVersion, 10);

    if (isNaN(majorVersion)) {
        fullVersion = '' + parseFloat(navigator.appVersion);
        majorVersion = parseInt(navigator.appVersion, 10);
    }

    return {
        fullVersion: fullVersion,
        version: majorVersion,
        name: browserName,
        isPrivateBrowsing: false
    };
}
1220425
function () {
            var names = [];

            Object.keys(this.smd.services || {}).forEach(function (serviceName) {
                names.push(serviceName);
            });

            return names;
        }
684610
def browsers(self, browser=None, browser_version=None, device=None, os=None, os_version=None):
        
        response = self.execute('GET', '/screenshots/browsers.json')
        for key, value in list(locals().items()):
            if key in ('self', 'response') or not value:
                continue
            response = [item for item in response if match_item(key, value, item)]
        return response
1206320
function (browserName, config) {
    var browser = this._verfiyBrowserConfig(browserName, config);
    var platform = this._verfiyPlatformConfig(browser);
    var driverConfig = config.get('driver.sauce');
    var desiredCaps = {
      browserName: browser.actAs,
      platform: platform,
      'screen-resolution': (browser['screen-resolution'] || null),
      version: (browser.version || this.desiredCapabilities['browser-version']),
      name: driverConfig.name || this.desiredCapabilities.name
    };

    // check if the user added tags
    if (driverConfig.tags) {
      desiredCaps.tags = driverConfig.tags;
    }

    // check if the user added a build id
    if (driverConfig.build) {
      desiredCaps.build = driverConfig.build;
    }

    return desiredCaps;
  }