<commit_before>var webdriver = require('selenium-webdriver');

function loadAssets (driver) {
  var s = '';
  s += 'var s = document.createElement("script");';
  s += 's.type = "text/javascript";'
  s += 's.src = "http://localhost:7000/core.js";';
  s += 'var domel = document.getElementsByTagName("script")[0];';
  s += 'domel.parentNode.insertBefore(s, domel);';
  driver.get('http://quailpages/forms/simple-form.html');
  driver.executeScript(s);
}

/**
 * creates a webdriver client
 * @param callBack or promise
 */
exports.createClient = function (callBack) {
  var serverConfig = 'http://127.0.0.1:4444/wd/hub';
  var capabilities = {
    silent: true, // maybe output more for tests?
    browserName: 'phantomjs',
    javascriptEnabled: true,
    takesScreenshot: true,
    databaseEnabled: false,
    cssSelectorsEnabled:true,
    webStorageEnabled: true
  };

  var driver = new webdriver
    .Builder()
    .usingServer(serverConfig)
    .withCapabilities(capabilities)
    .build();

  loadAssets(driver);

  if (typeof callBack === 'function') {<commit_msg>Append scripts to the load page<commit_after>var webdriver = require('selenium-webdriver');

function loadAssets (driver) {
  var s = '';
  s += 'var s = document.createElement("script");';
  s += 's.type = "text/javascript";'
  s += 's.src = "http://localhost:7000/core.js";';
  s += 'var domel = document.getElementsByTagName("head")[0];';
  s += 'if (domel) domel.appendChild(s, domel);';
  driver.get('http://quailpages/forms/simple-form.html');
  driver.executeScript(s);
}

/**
 * creates a webdriver client
 * @param callBack or promise
 */
exports.createClient = function (callBack) {
  var serverConfig = 'http://127.0.0.1:4444/wd/hub';
  var capabilities = {
    silent: true, // maybe output more for tests?
    browserName: 'phantomjs',
    javascriptEnabled: true,
    takesScreenshot: true,
    databaseEnabled: false,
    cssSelectorsEnabled:true,
    webStorageEnabled: true
  };

  var driver = new webdriver
    .Builder()
    .usingServer(serverConfig)
    .withCapabilities(capabilities)
    .build();

  loadAssets(driver);

  if (typeof callBack === 'function') {
{'fraction_non_alphanumeric': 0.1591647331786543, 'fraction_numerical': 0.013921113689095127, 'mean_word_length': 3.888888888888889, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2141977', 'n_tokens_mistral': 724, 'n_tokens_neox': 700, 'n_words': 155}