Skip to content

Instantly share code, notes, and snippets.

@mandric
Last active July 31, 2020 17:17
Show Gist options
  • Save mandric/c98a6c584545d5ca8f5af10ee05acf98 to your computer and use it in GitHub Desktop.
Save mandric/c98a6c584545d5ca8f5af10ee05acf98 to your computer and use it in GitHub Desktop.
"use script";
const webdriver = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const firefox = require('selenium-webdriver/firefox');
const edge = require('selenium-webdriver/edge');
const Command = require("selenium-webdriver/lib/command").Command;
const { logging } = webdriver
logging.installConsoleHandler()
logging.getLogger('webdriver.http').setLevel(logging.Level.ALL)
const prefs = new logging.Preferences()
prefs.setLevel(logging.Type.BROWSER, logging.Level.ALL)
const driver = new webdriver.Builder()
// Default to using Firefox. This can be overridden at runtime by
// setting the SELENIUM_BROWSER environment variable:
//
// SELENIUM_BROWSER=chrome node selenium-webdriver/example/logging.js
.forBrowser('firefox')
.setLoggingPrefs(prefs)
// Configure the service for each browser to enable verbose logging and
// to inherit the stdio settings from the current process. The builder
// will only start the service if needed for the selected browser.
.setChromeService(
new chrome.ServiceBuilder()
.enableVerboseLogging()
.setStdio('inherit')
)
.setEdgeService(
process.platform === 'win32'
? new edge.ServiceBuilder()
.enableVerboseLogging()
.setStdio('inherit')
: null
)
.setFirefoxService(
new firefox.ServiceBuilder()
.enableVerboseLogging()
.setStdio('inherit')
)
.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment