Determine browser capabilities
338476
function featureDetector(){
    // Check if client can access file sytem (from Modernizer)  
    var elem = document.createElement('input')
    elem.type = 'file'
    window.Photopipe.hasFileSystem = !elem.disabled

    // Check if client has media capture access 
    window.Photopipe.hasMediaCapture = !!navigator.getUserMedia || 
                                      !!navigator.webkitGetUserMedia || 
                                      !!navigator.mozGetUserMedia || 
                                      !!navigator.msGetUserMedia
                          
    // Check if client has the download attribute for anchor tags 
    window.Photopipe.hasDownloadAttribute = ("download" in document.createElement("a"))  
    
    // Check for localstorage
    var storage
    try{ if(localStorage.getItem) {storage = localStorage} }catch(e){}
    window.Photopipe.hasLocalStorage = storage                                
    
  }
203873
async def capability_check(self, optional=None, required=None):
        """"""

        self._check_receive_loop()
        # If the returned response is an error, self.query will raise an error
        await self.query(
            "version", {"optional": optional or [], "required": required or []}
        )
1240354
function envInfo () {
	var browser = browserInfo();
	var osName = browser.os;

	if (osName === 'MacOS') {
		osName = 'OS X';
	}

	return {
		runtime: {
			name: browser.name,
			version: browser.version
		},
		os: {
			name: osName
		}
	};
}
734964
public static function checkBrowserSafari()
    {
        if (stripos(self::$userAgentString, 'Safari') !== false) {
            $aresult = explode('/', stristr(self::$userAgentString, 'Version'));
            if (isset($aresult[1])) {
                $aversion = explode(' ', $aresult[1]);
                self::$browser->setVersion($aversion[0]);
            } else {
                self::$browser->setVersion(Browser::VERSION_UNKNOWN);
            }
            self::$browser->setName(Browser::SAFARI);

            return true;
        }

        return false;
    }
559281
def is_supported(self, user_agent_string):
        
        user_agent_obj = user_agents.parse(user_agent_string)
        browser_ok = True
        for rule in self.exclusions:
            if rule in ["mobile", "tablet", "touchcapable", "pc", "bot"]:
                if (
                    (rule == "mobile" and user_agent_obj.is_mobile)
                    or (rule == "tablet" and user_agent_obj.is_tablet)
                    or (rule == "touchcapable" and user_agent_obj.is_touch_capable)
                    or (rule == "pc" and user_agent_obj.is_pc)
                    or (rule == "bot" and user_agent_obj.is_bot)
                ):
                    browser_ok = False
            elif rule in user_agent_string:
                browser_ok = False

        return browser_ok
909200
protected function checkBrowserNetscape()
    {
        //BlackBerry & Nokia UAs can conflict with Netscape UAs
        if ($this->containString($this->_agent, array('BlackBerry', 'Nokia'), true, false)) {
            return false;
        }

        //Netscape v6 to v9 check
        if ($this->checkSimpleBrowserUA(array('Netscape', 'Navigator', 'Netscape6'), $this->_agent, self::BROWSER_NETSCAPE)) {
            return true;
        }

        //Netscape v1-4 (v5 don't exists)
        $found = false;
        if ($this->containString($this->_agent, 'Mozilla') && !$this->containString($this->_agent, 'rv:', true, false)) {
            $version = '';
            $verParts = explode('/', stristr($this->_agent, 'Mozilla'));
            if (count($verParts) > 1) {
                $verParts = explode(' ', $verParts[1]);
                $verParts = explode('.', $verParts[0]);

                $majorVer = $this->parseInt($verParts[0]);
                if ($majorVer > 0 && $majorVer < 5) {
                    $version = implode('.', $verParts);
                    $found = true;

                    if (strtolower(substr($version, -4)) == '-sgi') {
                        $version = substr($version, 0, -4);
                    } else {
                        if (strtolower(substr($version, -4)) == 'gold') {
                            $version = substr($version, 0, -4) . ' Gold'; //Doubles spaces (if any) will be normalized by setVersion()
                        }
                    }
                }
            }
        }

        if ($found) {
            $this->setBrowser(self::BROWSER_NETSCAPE);
            $this->setVersion($version);
            $this->setMobile(false);
            $this->setRobot(false);
        }

        return $found;
    }
639354
function browser(browserName, browserVersion, os, osVersion) {
  return {
    base: 'BrowserStack',
    browser: browserName,
    browser_version: browserVersion,
    os: os,
    os_version: osVersion
  };
}
323341
def get_osx_config(browser: str) -> dict:
    
    # Verify supported browser, fail early otherwise
    if browser.lower() == 'chrome':
        cookie_file = ('~/Library/Application Support/Google/Chrome/Default/'
                       'Cookies')
    elif browser.lower() == "chromium":
        cookie_file = '~/Library/Application Support/Chromium/Default/Cookies'
    else:
        raise ValueError("Browser must be either Chrome or Chromium.")

    config = {
        'my_pass': keyring.get_password(
            '{} Safe Storage'.format(browser), browser),
        'iterations': 1003,
        'cookie_file': cookie_file,
        }
    return config
291763
def to_capabilities(self):
        
        capabilities = ChromeOptions.to_capabilities(self)
        capabilities.update(self._caps)
        opera_options = capabilities[self.KEY]

        if self.android_package_name:
            opera_options["androidPackage"] = self.android_package_name
        if self.android_device_socket:
            opera_options["androidDeviceSocket"] = self.android_device_socket
        if self.android_command_line_file:
            opera_options["androidCommandLineFile"] = \
                self.android_command_line_file
        return capabilities
902076
def capabilityCheck(self, optional=None, required=None):
        
        res = self.query(
            "version", {"optional": optional or [], "required": required or []}
        )

        if not self._hasprop(res, "capabilities"):
            # Server doesn't support capabilities, so we need to
            # synthesize the results based on the version
            capabilities.synthesize(res, optional)
            if "error" in res:
                raise CommandError(res["error"])

        return res
291834
def _get_capabilities_from_driver_type(driver_name):
        
        if driver_name == 'firefox':
            return DesiredCapabilities.FIREFOX.copy()
        elif driver_name == 'chrome':
            return DesiredCapabilities.CHROME.copy()
        elif driver_name == 'safari':
            return DesiredCapabilities.SAFARI.copy()
        elif driver_name == 'opera':
            return DesiredCapabilities.OPERA.copy()
        elif driver_name == 'iexplore':
            return DesiredCapabilities.INTERNETEXPLORER.copy()
        elif driver_name == 'edge':
            return DesiredCapabilities.EDGE.copy()
        elif driver_name == 'phantomjs':
            return DesiredCapabilities.PHANTOMJS.copy()
        elif driver_name in ('android', 'ios', 'iphone'):
            return {}
        raise Exception('Unknown driver {0}'.format(driver_name))
234526
function _Browser_getViewportOf(id) {
    return _Browser_withNode(id, function(node) {
      return {
        scene: {
          width: node.scrollWidth,
          height: node.scrollHeight
        },
        viewport: {
          x: node.scrollLeft,
          y: node.scrollTop,
          width: node.clientWidth,
          height: node.clientHeight
        }
      };
    });
  }
1296403
function () {
		var version = 0;

		if ( this.chrome ) {
			version = navigator.userAgent.replace( /(.*chrome\/|safari.*)/gi, "" );
		}
		else if ( this.firefox ) {
			version = navigator.userAgent.replace( /(.*firefox\/)/gi, "" );
		}
		else if ( this.ie ) {
			version = navigator.userAgent.replace(/(.*msie|;.*)/gi, "");
		}
		else if ( this.opera ) {
			version = navigator.userAgent.replace( /(.*version\/|\(.*)/gi, "" );
		}
		else if ( this.safari ) {
			version = navigator.userAgent.replace( /(.*version\/|safari.*)/gi, "" );
		}
		else {
			version = navigator.appVersion || "0";
		}

		version = number.parse( string.trim( version ) );

		if ( isNaN( version ) ) {
			version = 0;
		}

		if ( this.ie && document.documentMode && document.documentMode < version ) {
			version = document.documentMode;
		}

		return version;
	}
351808
function (browsers, userAgent) {
      return detect(browsers, userAgent).map(function (browser) {
        var version = Version.detect(browser.versionRegexes, userAgent);
        return {
          current: browser.name,
          version: version
        };
      });
    }
1129570
def browser(browser_name='xdg-open'):

    """"""

    if not browser_name:
        return None
    argv = shlex.split(browser_name)
    executable = find_executable(argv[0])
    if executable is None:
        # Why not raise an exception? -I think it is more convenient (for
        # end users) to have a reasonable default, without enforcing it.
        logging.getLogger(__name__).warn(
            _("Can't find file browser: {0!r}. "
              "You may want to change the value for the '-f' option.",
              browser_name))
        return None

    def browse(path):
        return subprocess.Popen(argv + [path])

    return browse
905478
function InternetExplorerDriver(capabilities) {
  var instance;
  var len = arguments.length;

  if (!len) {
    instance = new Class();
  } else if (len === 1) {
    assert(capabilities)
      .extends(Capabilities)
      .throws(
        messages.UN_FINISHED_CONSTRUCTOR
        );
    instance = new Class(capabilities._instance);
  } else {
    throw new Error(messages.UN_FINISHED_CONSTRUCTOR);
  }

  addFinalProp(this, '_instance', instance);
}
1119771
public static function check_ie_properties() {
        // Internet Explorer.
        $useragent = self::get_user_agent_string();
        if ($useragent === false) {
            return false;
        }
        if (strpos($useragent, 'Opera') !== false) {
            // Reject Opera.
            return false;
        }
        // See: http://www.useragentstring.com/pages/Internet%20Explorer/.
        if (preg_match("/MSIE ([0-9\.]+)/", $useragent, $match)) {
            $browser = $match[1];
        // See: http://msdn.microsoft.com/en-us/library/ie/bg182625%28v=vs.85%29.aspx for IE11+ useragent details.
        } else if (preg_match("/Trident\/[0-9\.]+/", $useragent) && preg_match("/rv:([0-9\.]+)/", $useragent, $match)) {
            $browser = $match[1];
        } else {
            return false;
        }

        $compatview = false;
        // IE8 and later versions may pretend to be IE7 for intranet sites, use Trident version instead,
        // the Trident should always describe the capabilities of IE in any emulation mode.
        if ($browser === '7.0' and preg_match("/Trident\/([0-9\.]+)/", $useragent, $match)) {
            $compatview = true;
            $browser = $match[1] + 4; // NOTE: Hopefully this will work also for future IE versions.
        }
        $browser = round($browser, 1);
        return array(
            'version'    => $browser,
            'compatview' => $compatview
        );
    }