Skip to content

Instantly share code, notes, and snippets.

Last active Sep 9, 2020
What would you like to do?
Disable ChromeDriver messages to stdout with Selenium WebDriver & NodeJS

Make sure you have the minimum dependencies (e.g. you have run yarn add selenium-webdriver), and edit the file with your chromedriver bin info.

Here is a full writeup

// @ts-check
const path = require('path');
const { ServiceBuilder, Options: ChromeOptions } = require('selenium-webdriver/chrome');
const webdriver = require('selenium-webdriver');
async function main() {
// I'm doing this because I hate adding things to my PATH 😅
// Normally, webdriver will automatically grab the EXE from PATH if you have followed a generic setup guide
const driverBinPath = path.normalize(`C:\\Users\\Joshua\\Downloads\\chromedriver_win32\\chromedriver.exe`);
const serviceBuilder = new ServiceBuilder(driverBinPath);
* By excluding the switch from defaults, this should disable the default logging
* @see
const chromeOptions = new ChromeOptions();
// Put everything together
const driver = await new webdriver.Builder()
// Let's try something
await driver.get(``);
const title = await driver.getTitle();
return title;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment