How to use the selenium-webdriver.logging function in selenium-webdriver

To help you get started, we’ve selected a few selenium-webdriver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / protractor / lib / ptor.ts View on Github external
// Export selenium webdriver.
  Actions = webdriver.Actions;
  Browser = webdriver.Browser;
  Builder = webdriver.Builder;
  Button = webdriver.Button;
  Capabilities = webdriver.Capabilities;
  Capability = webdriver.Capability;
  EventEmitter = webdriver.EventEmitter;
  FileDetector = webdriver.FileDetector;
  Key = webdriver.Key;
  Session = webdriver.Session;
  WebDriver = webdriver.WebDriver;
  WebElement = webdriver.WebElement;
  WebElementPromise = webdriver.WebElementPromise;
  error = webdriver.error;
  logging = webdriver.logging;
  promise = webdriver.promise;
  until = webdriver.until;
  Command = command.Command;
  CommandName = command.Name;
  utils = {firefox: firefox, http: http, remote: remote, chrome: chrome};
}

export let protractor = new Ptor();
github FuelInteractive / fuel-ui / node_modules / angular2 / src / testing / e2e_util.js View on Github external
var filteredLog = browserLog.filter(function (logEntry) {
            if (logEntry.level.value >= webdriver.logging.Level.INFO.value) {
                console.log('>> ' + logEntry.message);
            }
            return logEntry.level.value > webdriver.logging.Level.WARNING.value;
        });
        expect(filteredLog).toEqual([]);
github FuelInteractive / fuel-ui / node_modules / angular2 / src / testing / e2e_util.js View on Github external
var filteredLog = browserLog.filter(function (logEntry) {
            if (logEntry.level.value >= webdriver.logging.Level.INFO.value) {
                console.log('>> ' + logEntry.message);
            }
            return logEntry.level.value > webdriver.logging.Level.WARNING.value;
        });
        expect(filteredLog).toEqual([]);
github thx / chartx / testfile.js View on Github external
function readFile(filename) {
    console.log("-------   open:\t"+filename.replace(__dirname,''));
    driver.get('file://' + filename);

    driver.manage().logs().get(webdriver.logging.Type.BROWSER, webdriver.logging.Level.ALL)
        .then(function (entries) {
            entries.forEach(function (entry) {
                console.log('[%s] %s', entry.level.name, entry.message);
            });
            if (NUM + 1 < fileList.length) {
                setTimeout(function () {
                    promiseCall(fileList[++NUM]).then(readFile);
                }, 500);
            }else{

                console.log('测试完毕,共测试了'+fileList.length+'个DEMO');
            };

        });
}
github panacloud / learn-angular / step9_gulp_router / node_modules / angular2 / src / test_lib / e2e_util.js View on Github external
var filteredLog = browserLog.filter(function (logEntry) {
            if (logEntry.level.value >= webdriver.logging.Level.INFO.value) {
                console.log('>> ' + logEntry.message);
            }
            return logEntry.level.value > webdriver.logging.Level.WARNING.value;
        });
        expect(filteredLog.length).toEqual(0);
github fippo / testbed / webdriver.js View on Github external
if (options.devices.screen) {
      chromeOptions.addArguments('auto-select-desktop-capture-source=' + options.devices.screen);
    }
    if (options.devices.extension) {
      chromeOptions.addArguments('load-extension=' + options.devices.extension);
    }
  }

  const edgeOptions = new edge.Options();

  const safariOptions = new safari.Options();
  safariOptions.setTechnologyPreview(options.bver === 'unstable');

  const loggingPreferences = new webdriver.logging.Preferences();
  if (options.browserLogging) {
    loggingPreferences.setLevel(webdriver.logging.Type.BROWSER, webdriver.logging.Level.ALL);
  }

  let driver = new webdriver.Builder()
      .setFirefoxOptions(firefoxOptions)
      .setChromeOptions(chromeOptions)
      .setEdgeOptions(edgeOptions)
      .setSafariOptions(safariOptions)
      .setLoggingPrefs(loggingPreferences)
      .forBrowser(browser);
  if (browser === 'chrome') {
    driver.getCapabilities().set('goog:chromeOptions', chromeOptions);
  }
  if (browser === 'firefox') {
    driver.getCapabilities().set('moz:firefoxOptions', firefoxOptions);
  }
  if (options.server === true) {
github one-more / sprute / test / src / selenium-tests.js View on Github external
'use strict';

let webdriver = require('selenium-webdriver'),
    logging = webdriver.logging,
    chrome = require('selenium-webdriver/chrome'),
    chromePath = require('chromedriver').path,
    async = require('async'),
    until = webdriver.until,
    path = require('path'),
    By = webdriver.By,
    assert = require('assert'),
    crypto = require('crypto'),
    process = require('process'),
    seo = require(process.cwd()+'/tests-client/configuration/seo'),
    bundleResult = require(process.cwd()+'/static/bundle-result'),
    themeSecond = require(process.cwd()+'/tests-client/configuration/theme-second'),
    build = require(process.cwd()+'/configuration/static'),
    _ = require('underscore');

function runChrome() {
github vue-gl / vue-gl / .circleci / selenium.js View on Github external
function exit() {
    driver.manage().logs().get(webdriver.logging.Type.BROWSER).then((entries) => {
        entries.forEach((entry) => {
            console.log('[%s] %s', entry.level.name, entry.message);
        });
    });
    driver.takeScreenshot().then((data) => {
        require("fs").writeFileSync("screenshot.png", data, "base64");
        driver.quit();
    });
}
github alibaba / rax / scripts / bench / src / runner.js View on Github external
async function computeResultsCPU(
  driver,
  benchmarkOptions,
  framework,
  benchmark,
  warnings
) {
  let entriesBrowser = await driver
    .manage()
    .logs()
    .get(selenium_webdriver.logging.Type.BROWSER);
  if (config.LOG_DEBUG) console.log('browser entries', entriesBrowser);
  const perfLogEvents = await fetchEventsFromPerformanceLog(driver);
  let filteredEvents = perfLogEvents.timingResults;
  if (config.LOG_DEBUG)
    console.log('filteredEvents ', asString(filteredEvents));
  let remaining = R.dropWhile(type_eq('initBenchmark'))(filteredEvents);
  let results = [];
  while (remaining.length > 0) {
    let evts = R.splitWhen(type_eq('finishedBenchmark'))(remaining);
    if (R.find(type_neq('runBenchmark'))(evts[0]) && evts[1].length > 0) {
      let eventsDuringBenchmark = R.dropWhile(type_neq('runBenchmark'))(
        evts[0]
      );
      if (config.LOG_DEBUG)
        console.log('eventsDuringBenchmark ', eventsDuringBenchmark);
      let clicks = R.filter(type_eq('click'))(eventsDuringBenchmark);
github smithclay / lambdium / src / lib / chromium.js View on Github external
exports.createSession = function() {
  var service;
  if (process.env.LOG_DEBUG || process.env.SAM_LOCAL) {
    service = new chrome.ServiceBuilder(CHROMEDRIVER_PATH)
      .loggingTo('/tmp/chromedriver.log')
      .build();
  } else {
    service = new chrome.ServiceBuilder(CHROMEDRIVER_PATH)
      .build();
  }

  const options = new chrome.Options();

  const logPrefs = new webdriver.logging.Preferences();
  logPrefs.setLevel(webdriver.logging.Type.PERFORMANCE, webdriver.logging.Level.ALL);
  options.setLoggingPrefs(logPrefs);

  options.setPerfLoggingPrefs({ enableNetwork: true, enablePage: true });
  options.setChromeBinaryPath(HEADLESS_CHROME_PATH);
  options.addArguments(defaultChromeFlags);
  return chrome.Driver.createSession(options, service);
}