Run the specified Selenium test(s) the indicated number of times in
        the specified browser.
771529
def handle(self, *args, **options):
        
        browser_name = options['browser_name']
        count = options['count']
        if len(args) > 0:
            tests = list(args)
        else:
            tests = settings.SELENIUM_DEFAULT_TESTS

        # Kill any orphaned chromedriver processes
        process = Popen(['killall', 'chromedriver'],
                        stderr=open(os.devnull, 'w'))
        process.wait()

        # Clear any old log and screenshots
        self.clean()

        docker = None
        sc_process = None
        selenium_process = None
        if options['docker']:
            if browser_name not in ['chrome', 'firefox']:
                self.stdout.write('Only chrome and firefox can currently be run in a Docker container')
                return
            docker = DockerSelenium(browser=browser_name,
                                    port=settings.SELENIUM_DOCKER_PORT,
                                    tag=settings.SELENIUM_DOCKER_TAG,
                                    debug=settings.SELENIUM_DOCKER_DEBUG)
        elif 'platform' in options and settings.SELENIUM_SAUCE_CONNECT_PATH:
            running, sc_process = self.verify_sauce_connect_is_running(options)
            if not running:
                return
        elif browser_name in ['opera', 'safari']:
            running, selenium_process = self.verify_selenium_server_is_running()
            if not running:
                return
        elif browser_name in ['ipad', 'iphone']:
            if not self.verify_appium_is_running():
                return

        # Make it so django-nose won't have nosetests choke on our parameters
        TestRunner = get_runner(django_settings)
        if hasattr(TestRunner, 'django_opts'):
            for option in OPTIONS:
                TestRunner.django_opts.extend(option[0])

        # Configure and run the tests
        try:
            if docker:
                docker.start()
                options['command_executor'] = docker.command_executor()
            self.update_environment(options)
            self.run_tests(tests, browser_name, count)
        finally:
            # Stop the Selenium Docker container, if running
            if docker and docker.container_id:
                docker.stop()

        # Kill Sauce Connect, if running
        if sc_process:
            sc_process.kill()

        # Kill the Selenium standalone server, if running
        if selenium_process:
            selenium_process.kill()
57179
def run_suite(self, suite, **kwargs):
        """"""
        return self.test_runner(
            verbosity=self.verbosity,
            failfast=self.failfast,
            no_colour=self.no_colour,
        ).run(suite)
968830
def run_experiment(self):
        """"""
        try:
            self.sign_up()
            self.participate()
            if self.sign_off():
                self.complete_experiment("worker_complete")
            else:
                self.complete_experiment("worker_failed")
        finally:
            self.driver.quit()
1148474
def run_plugins(plugins, url_data, stop_after_match=False, **kwargs):
    """"""
    for plugin in plugins:
        log.debug(LOG_PLUGIN, "Run plugin %s", plugin.__class__.__name__)
        if plugin.applies_to(url_data, **kwargs):
            plugin.check(url_data)
            if stop_after_match:
                break
1193021
public void run()
    {
        try
        {
            log.debug("CLOCK: Starting server-side thread");

            while (active)
            {
                Collection<ScriptSession> sessions = sctx.getScriptSessionsByPage("/dwr/clock/index.html");
                Util pages = new Util(sessions);
                pages.setValue("clockDisplay", new Date().toString());

                log.debug("Sent message");
                Thread.sleep(1000);
            }

            Collection<ScriptSession> sessions = sctx.getScriptSessionsByPage("/dwr/clock/index.html");
            Util pages = new Util(sessions);
            pages.setValue("clockDisplay", "");

            log.debug("CLOCK: Stopping server-side thread");
        }
        catch (InterruptedException ex)
        {
            ex.printStackTrace();
        }
    }
267010
def run(entry_point, drivers, loop = None):
    ''' 
    '''
    program = setup(entry_point, drivers)
    dispose = program.run()
    if loop == None:
        loop = asyncio.get_event_loop()

    loop.run_forever()
    dispose()
537291
protected void run(List<TestDescription> selectedTests) {
    mRunning = true;
    mTotalTestCount = selectedTests.size();
    mRunnerBean.run(this, selectedTests);
  }
160497
def open_in_browser(self, n_times):
        

        for _ in range(n_times):
            webbrowser.open(self.url)
1342345
def selenium(self):
        
        if not self._web_driver:
            self._web_driver = self._start_driver()
        return self._web_driver
59358
function(count) {
      var me = this;

      // Make sure calibration tests have run
      if (!me.isCalibration && Test.calibrate(function() {me.run(count);})) return;
      this.error = null;

      try {
        var start, f = this.f, now, i = count;

        // Start the timer
        start = new Date();

        // Now for the money shot.  If this is a looping function ...
        if (this.loopArg) {
          // ... let it do the iteration itself
          f(count);
        } else {
          // ... otherwise do the iteration for it
          while (i--) f();
        }

        // Get time test took (in secs)
        this.time = Math.max(1,new Date() - start)/1000;

        // Store iteration count and per-operation time taken
        this.count = count;
        this.period = this.time/count;

        // Do we need to do another run?
        this.running = this.time <= this.MIN_TIME;

        // ... if so, compute how many times we should iterate
        if (this.running) {
          // Bump the count to the nearest power of 2
          var x = this.MIN_TIME/this.time;
          var pow = Math.pow(2, Math.max(1, Math.ceil(Math.log(x)/Math.log(2))));
          count *= pow;
          if (count > this.MAX_COUNT) {
            throw new Error('Max count exceeded.  If this test uses a looping function, make sure the iteration loop is working properly.');
          }
        }
      } catch (e) {
        // Exceptions are caught and displayed in the test UI
        this.reset();
        this.error = e;
      }

      // Figure out what to do next
      if (this.running) {
        me.run(count);
      } else {
        jsl.status('');
        me.onStop(me);
      }

      // Finish up
      this.onChange(this);
    }
424881
def run(self):
        """"""
        if self.target_eff_nsamples and self.checkpoint_interval is None:
            raise ValueError("A checkpoint interval must be set if "
                             "targetting an effective number of samples")
        # get the starting number of samples:
        # "nsamples" keeps track of the number of samples we've obtained (if
        # target_eff_nsamples is not None, this is the effective number of
        # samples; otherwise, this is the total number of samples).
        # _lastclear is the number of iterations that the file already
        # contains (either due to sampler burn-in, or a previous checkpoint)
        if self.new_checkpoint:
            self._lastclear = 0
        else:
            with self.io(self.checkpoint_file, "r") as fp:
                self._lastclear = fp.niterations
        if self.target_eff_nsamples is not None:
            target_nsamples = self.target_eff_nsamples
            with self.io(self.checkpoint_file, "r") as fp:
                nsamples = fp.effective_nsamples
        elif self.target_niterations is not None:
            # the number of samples is the number of iterations times the
            # number of walkers
            target_nsamples = self.nwalkers * self.target_niterations
            nsamples = self._lastclear * self.nwalkers
        else:
            raise ValueError("must set either target_eff_nsamples or "
                             "target_niterations; see set_target")
        self._itercounter = 0
        # figure out the interval to use
        iterinterval = self.checkpoint_interval
        if iterinterval is None:
            iterinterval = self.target_niterations
        # run sampler until we have the desired number of samples
        while nsamples < target_nsamples:
            # adjust the interval if we would go past the number of iterations
            if self.target_niterations is not None and (
                    self.niterations + iterinterval > self.target_niterations):
                iterinterval = self.target_niterations - self.niterations
            # run sampler and set initial values to None so that sampler
            # picks up from where it left off next call
            logging.info("Running sampler for {} to {} iterations".format(
                self.niterations, self.niterations + iterinterval))
            # run the underlying sampler for the desired interval
            self.run_mcmc(iterinterval)
            # update the itercounter
            self._itercounter = self._itercounter + iterinterval
            # dump the current results
            self.checkpoint()
            # update nsamples for next loop
            if self.target_eff_nsamples is not None:
                nsamples = self.effective_nsamples
                logging.info("Have {} effective samples post burn in".format(
                    nsamples))
            else:
                nsamples += iterinterval * self.nwalkers
1178792
@When("^I clear the content on text input at index '(\\d+?)'$")
    public void seleniumClear(Integer index) {
        assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required")
                .hasAtLeast(index);

        assertThat(this.commonspec, commonspec.getPreviousWebElements().getPreviousWebElements().get(index)).isTextField(commonspec.getTextFieldCondition());

        commonspec.getPreviousWebElements().getPreviousWebElements().get(index).clear();
    }
1178699
function start( next, isHeadless, options ) {
    function seleniumStarted() {
        console.log( 'seleniumrc webdriver ready on ' + options.host + ':' + options.port );
        started = true;
        starting = false;
        if ( typeof next === 'function' ) {
            return next();
        }
    }

    if ( started ) {
        return next(console.log('already started'));
    }

    if ( isHeadless ) {
        selOptions.push ( '-role');
        selOptions.push ( 'hub');
    }

    selOptions.push ( '-host' );
    selOptions.push ( options.host );

    selOptions.push ( '-port' );
    selOptions.push ( options.port );

    if ( options.timeout) {
        selOptions.push( '-timeout' );
        selOptions.push( options.timeout );
    }

    if ( options.maxSession) {
        selOptions.push( '-maxSession' );
        selOptions.push( options.maxSession );
    }

    var spawnOptions = options['cwd'] ? {cwd: options['cwd']} : undefined;
    seleniumServerProcess = spawn( 'java', selOptions, spawnOptions );
    // selenium webdriver has a port prober in it which could be factored in.
    seleniumServerProcess.on('uncaughtException', function(err) {
        if(err.errno === 'EADDRINUSE' ){
            console.log ('PORT already IN USE, assume selenium running');
            next();
        } else {
            console.trace(err);
            process.exit(1);
        }
    });

    seleniumServerProcess.stderr.setEncoding('utf8');
    // parse procee output until server is actually ready, otherwise next task will break
    seleniumServerProcess.stderr.on('data', function(data) {
        var errMsg;
        data = data.trim();
        if ( isHeadless  ) {
            // check for grid started, which is outputted to standard error
            if ( data.indexOf( 'Selenium Grid hub is up and running' ) > -1 ) {
//                console.log ('selenium hub ready');
                return startPhantom(next, options);
            } else if ( data.indexOf ('Address already in use') > -1 ) {
                // throw error if already started
                 errMsg = 'FATAL ERROR starting selenium: ' + data + ' maybe try killall -9 java';
                throw errMsg;
            }
        } else if ( data.indexOf( 'Selenium Server is up and running' ) > -1 ) {
            // seems selenium 2.43.1 now outputs logs to standard error too so listening to standard out is redundant?
            seleniumStarted();
        } else if ( !started &&  data.indexOf( 'Selenium Server is up and running') > -1  ) {
            // as of 2.471 this nice clear message appears
            seleniumStarted();
        } else if ( data &&
             // throw error if something unexpected happens
             data.indexOf('org.openqa.grid.selenium.GridLauncher main') === -1 &&
             data.indexOf('Setting system property') === -1 &&
             data.indexOf('INFO') === -1 &&
             data.indexOf('WARNING') === -1 &&
             !started
              ) {
            errMsg = 'FATAL ERROR starting selenium: ' + data+ ' is java runtime installed?';
            throw errMsg;
        }
    });
    seleniumServerProcess.stdout.setEncoding('utf8');
    // seems selenium 2.43.1 now outputs logs to standard error too so this is now redundant
    // will leave for now. Tested on mac and ubuntu
    seleniumServerProcess.stdout.on('data', function( msg ) {
        console.log('STDOUT' , msg);
        // monitor process output for ready message, most recent version gives a nice clear message on standard error
        // but have left java trigger for support for older seleniums as can select in config
        if ( !started && ( msg.indexOf( 'Started org.openqa.jetty.jetty.servlet.ServletHandler' ) > -1  )) {
            seleniumStarted();
        }
    });

}
1136309
def run_selected_clicked(self):
        """"""
        # get all selected rows
        rows = sorted(set(index.row() for index in
                          self.table.selectedIndexes()))
        self.enable_busy_cursor()
        # iterate over selected rows
        for row in rows:
            current_row = row
            item = self.table.item(current_row, 0)
            status_item = self.table.item(current_row, 1)
            self.run_task(item, status_item)
        self.disable_busy_cursor()
244709
def _run_sequence(self, sequence):
        '''
        
        '''
        self._check_pause()
        self._pre_test()
        session_data = self.target.get_session_data()
        self._test_info()
        resp = None
        for edge in sequence:
            if edge.callback:
                edge.callback(self, edge, resp)
            session_data = self.target.get_session_data()
            node = edge.dst
            node.set_session_data(session_data)
            resp = self._transmit(node)
        return self._post_test()
198484
def run(self):
        

        self.info_log("The test batch is ready.")

        self.executed_tests = []

        for test in self.tests:
            localhost_instance = LocalhostInstance(
                runner=self,
                browser_config=self.browser_config,
                test_name=test.Test.name
            )

            localhost_instance.startup()

            with DbSessionContext(BROME_CONFIG['database']['mongo_database_name']) as session:  # noqa
                test_batch = session.query(Testbatch)\
                    .filter(Testbatch.mongo_id == self.test_batch_id).one()
                test_batch.total_executing_tests = 1
                session.save(test_batch, safe=True)

            test_ = test.Test(
                runner=self,
                browser_config=self.browser_config,
                name=test.Test.name,
                test_batch_id=self.test_batch_id,
                localhost_instance=localhost_instance,
                index=1
            )

            test_.execute()
            self.executed_tests.append(test_)

            localhost_instance.tear_down()
960740
def run(self):
        """"""
        if self.auto_clear:
            os.system('cls' if os.name == 'nt' else 'auto_clear')
        else:
            print
        print 'Running unit tests...'
        if self.auto_clear:
            print
        subprocess.call('nosetests', cwd=self.directory)