Creates an instance of Safari webdriver.
551675
def __create_safari_driver(self):
        '''
        
        '''
        # Check for selenium jar env file needed for safari driver.
        if not os.getenv(self.__SELENIUM_SERVER_JAR_ENV):
            # If not set, check if we have a config setting for it.
            try:
                selenium_server_path = self._config_reader.get(
                    self.SELENIUM_SERVER_LOCATION)
                self._env_vars[
                    self.__SELENIUM_SERVER_JAR_ENV] = selenium_server_path
            except KeyError:
                raise RuntimeError(u("Missing selenium server path config {0}.").format(
                    self.SELENIUM_SERVER_LOCATION))

        return webdriver.Safari()
458072
def _create_local_driver(self):
        
        driver_type = self.config.get('Driver', 'type')
        driver_name = driver_type.split('-')[0]

        if driver_name in ('android', 'ios', 'iphone'):
            # Create local appium driver
            driver = self._setup_appium()
        else:
            driver_setup = {
                'firefox': self._setup_firefox,
                'chrome': self._setup_chrome,
                'safari': self._setup_safari,
                'opera': self._setup_opera,
                'iexplore': self._setup_explorer,
                'edge': self._setup_edge,
                'phantomjs': self._setup_phantomjs
            }
            driver_setup_method = driver_setup.get(driver_name)
            if not driver_setup_method:
                raise Exception('Unknown driver {0}'.format(driver_name))

            # Get driver capabilities
            capabilities = self._get_capabilities_from_driver_type(driver_name)
            self._add_capabilities_from_properties(capabilities, 'Capabilities')

            # Create local selenium driver
            driver = driver_setup_method(capabilities)

        return driver
119850
function HtmlUnitDriver(
  desiredCapabilitiesOrEnableJavascript
  ) {
  var instance;
  var first = desiredCapabilitiesOrEnableJavascript;
  var len = arguments.length;

  if (!len) {
    instance = new Class();
  } else if (len === 1) {
    if (assert(first).extends(Capabilities).isValid) {
      instance = new Class(first._instance);
    } else if (assert.isBool(first)) {
      instance = new Class(first);
    } else {
      throw new Error(
        'The first argument must be an instance of Capabilities or a boolean.'
       );
    }
  } else {
    throw new Error('The wrong number of arguments was given.');
  }

  addFinalProp(this, '_instance', instance);
}
177800
public WebDriverExecutor getWebDriverExecutor() {
        if (webDriverExecutor == null) {
            if (webDriverProvider == null) {
                webDriverExecutor = new WebDriverExecutor();
            } else {
                webDriverExecutor = new WebDriverExecutor(webDriverProvider);
            }
        }
        return webDriverExecutor;
    }
701581
private function createConfigurationDriver()
    {
        $reflection = new \ReflectionClass($this->driverClass());

        /** @var ConfigurationInterface $config */
        $config = $reflection->hasMethod('__construct')
            ? $reflection->newInstanceArgs([$this->file])
            : $reflection->newInstance();
        return $config;
    }
1151457
function Selenium(options) {

  if (!options) {
    throw new Error('options is required');
  }

  if (booleanHelper.isFalsey(options.port)) {
    throw new Error('options.port is required');
  }

  this.options = _.clone(options);

  this.seleniumStandaloneOptions = options.seleniumStandaloneOptions;

  if (!this.options['clean-selenium-server']) {
    // poor-man's singleton is enough for our needs
    if (typeof Selenium.instance === 'object') {
      log.debug('[chimp][selenium]', 'Selenium object already exists, not creating a new one');
      return Selenium.instance;
    }
    log.debug('[chimp][selenium]', 'Selenium object created');
    Selenium.instance = this;
  }

  this.options.port = String(options.port);
  this.child = null;
}
1141508
def create_shot_browser(self, ):
        
        shotbrws = ListBrowser(4, headers=['Sequence', 'Shot', 'Task', 'Descriptor'])
        self.shot_browser_vbox.insertWidget(0, shotbrws)
        return shotbrws
776860
def create_instance(self, plugin_type, plugin_name, **instance_kwargs):
        """"""
        plugin_type = self._get_plugin_type(plugin_type)
        return plugin_type.create_instance(plugin_name, **instance_kwargs)
603383
def gen_local_driver(browser, capabilities):
        ''' 
        '''
        if browser == "firefox":
            fp = capabilities.pop("firefox_profile",None)
            return webdriver.Firefox(desired_capabilities =capabilities, firefox_profile=fp)
                   
        elif browser == "chrome":            
            return webdriver.Chrome(desired_capabilities=capabilities)
        
        else:
            raise TypeError("Unsupport browser {}".format(browser))
51613
def instantiate(self):
        
        if self.instance is None:
            self.instance = checked_call(self.cls, self.kwds)
        #endif
        try:
            self.instance.yaml_src = self.yaml_src
        except AttributeError:
            pass
        return self.instance
531862
def get_driver(browser='firefox', args=None):
    
    if browser not in BROWSER_MAPPING.keys():
        raise RuntimeError("unknown browser %s. allowed: %s" % (browser, ", ".join(BROWSER_MAPPING.keys())))
    driver_cls = BROWSER_MAPPING.get(browser)
    safe_args = {}
    if args is not None:
        expected_arguments = inspect.getargspec(driver_cls.__init__).args
        expected_arguments.remove("self")
        for arg in expected_arguments:
            if arg in args:
                safe_args[arg] = args[arg]
    return driver_cls(**safe_args)
1073970
public WebDriverWait newWebDriverWait() {
		return wef.getSleepMillis() > 0L
			? newWebDriverWait(wef.getTimeoutSeconds(), wef.getSleepMillis())
				: newWebDriverWait(wef.getTimeoutSeconds());
	}
881238
public static GlClient create() {
        Injector injector = Guice.createInjector(getLocalModules());
        return injector.getInstance(GlClient.class);
    }
1089190
def driver(self):
        """"""
        from dallinger.config import get_config

        config = get_config()
        if not config.ready:
            config.load()
        driver_url = config.get("webdriver_url", None)
        driver_type = config.get("webdriver_type")
        driver = None

        if driver_url:
            capabilities = CAPABILITY_MAP.get(driver_type.lower())
            if capabilities is None:
                raise ValueError(
                    "Unsupported remote webdriver_type: {}".format(driver_type)
                )
            driver = webdriver.Remote(
                desired_capabilities=capabilities, command_executor=driver_url
            )
        else:
            driver_class = DRIVER_MAP.get(driver_type.lower())
            if driver_class is not None:
                driver = driver_class()

        if driver is None:
            raise ValueError("Unsupported webdriver_type: {}".format(driver_type))

        driver.set_window_size(1024, 768)
        logger.info("Created {} webdriver.".format(driver_type))
        return driver
932020
public function _initialize() {
		$this->wd_host = sprintf( 'http://%s:%s@hub.browserstack.com/wd/hub', $this->config['username'], $this->config['access_key'] );

		$this->capabilities = $this->config['capabilities'];
		$this->capabilities[ \WebDriverCapabilityType::BROWSER_NAME ] = $this->config['browser'];
		if ( ! empty( $this->config['version'] ) ) {
			$this->capabilities[ \WebDriverCapabilityType::VERSION ] = $this->config['version'];
		}

		$this->webDriver = \RemoteWebDriver::create( $this->wd_host, $this->capabilities );
		$this->webDriver->manage()->timeouts()->implicitlyWait( $this->config['wait'] );

		$this->initialWindowSize();
	}
170333
function instantiateDrivers(config, defaultDriverInstance) {
    config.actionConfigs.forEach(action => {
            action.driverInstance=action.driver?action.driver():defaultDriverInstance;
    });
    return config;
}
1188761
static Object newInstance (ClassLoader classLoader, String className)
        throws ClassNotFoundException, IllegalAccessException,
            InstantiationException
    {
        Class driverClass;
        if (classLoader == null) {
            driverClass = Class.forName(className);
        } else {
            driverClass = classLoader.loadClass(className);
        }
        return driverClass.newInstance();
    }