Experimental Chrome Options in Selenium Node.js

Viewed 1296

I need to convert these python lines:

options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(executable_path='<path-to-chrome>', options=options)

From this issue: Python selenium: DevTools listening on ws://127.0.0.1

I don't know how to add experimental options in Node.js, I can't find any documentation.

1 Answers

I also couldn't find the experimental chrome options in Selenium Node.js. But if you want to exclude a chrome switch I think you can do it like this:

const {Builder} = require('selenium-webdriver')
const chrome = require('selenium-webdriver/chrome'); 

const chromeOptions = new chrome.Options()
chromeOptions.excludeSwitches("enable-logging")

let driver = await new Builder().forBrowser('chrome').setChromeOptions(chromeOptions).build();
Related