How to use the logging function from selenium-webdriver

Find comprehensive JavaScript selenium-webdriver.logging code examples handpicked from public code repositorys.

128
129
130
131
132
133
134
135
136
137
  });
}

// Provide the webdriver driver and type of logging:
// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/logging_exports_Type.html
// Browser console logs: webdriver.logging.Type.BROWSER
// WebDriver driver logs: webdriver.logging.Type.DRIVER
function getLogs(driver, type) {
  // https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/webdriver_exports_Logs.html
  driver.manage().logs().get(type)
fork icon18
star icon37
watch icon26

+ 49 other calls in file

144
145
146
147
148
149
150
151
152
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);
}
fork icon11
star icon26
watch icon4

+ 3 other calls in file

8
9
10
11
12
13
14
15
16
17
var MAGIC_PREFIX = '##_meteor_magic##';
var MAGIC_PREFIX_REGEX = new RegExp(MAGIC_PREFIX);

var options = new chrome.Options();
var logOptions = new webdriver.logging.Preferences();
logOptions.setLevel('browser', webdriver.logging.Level.ALL);
options.setLoggingPrefs(logOptions);
options.addArguments('disable-setuid-sandbox');
options.addArguments('no-sandbox');
options.addArguments('allow-insecure-localhost');
fork icon5
star icon3
watch icon4

+ 3 other calls in file

-2
fork icon1
star icon3
watch icon2

+ 3 other calls in file

22
23
24
25
26
27
28
29
30
31
this.Session = webdriver.Session;
this.WebDriver = webdriver.WebDriver;
this.WebElement = webdriver.WebElement;
this.WebElementPromise = webdriver.WebElementPromise;
this.error = webdriver.error;
this.logging = webdriver.logging;
this.promise = webdriver.promise;
this.until = webdriver.until;
this.Command = require('selenium-webdriver/lib/command').Command;
this.CommandName = require('selenium-webdriver/lib/command').Name;
fork icon1
star icon0
watch icon2

1
2
3
4
5
6
7
8
9
10

const webdriver = require('selenium-webdriver');
const remote = require('selenium-webdriver/remote');

function loggingPrefs(opts) {
  if (opts instanceof webdriver.logging.Preferences) return opts;
  const prefs = new webdriver.logging.Preferences();
  Object.keys(opts).forEach(key => {
    const type = webdriver.logging.Type[key.toUpperCase()];
    const level = webdriver.logging.Level[opts[key].toUpperCase()];
fork icon0
star icon2
watch icon2

+ 7 other calls in file

46
47
48
49
50
51
52
53
54
55
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 = require('selenium-webdriver/lib/command').Command;
CommandName = require('selenium-webdriver/lib/command').Name;
fork icon0
star icon0
watch icon35

+ 5 other calls in file