2

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.

Berstigma
  • 313
  • 1
  • 2
  • 9

2 Answers2

1

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();
MOSI
  • 561
  • 7
  • 8
  • your answer was flagged as low quality, try to explain in a few sentences what it is your code does. Perhaps this is the correct answer but in its current state it is hard to follow. Sometimes WHY is more important than HOW. – Bazzz Jul 14 '21 at 08:11
0

MOSI's solution worked for me (thanks by the way). I'd upvote but don't have enough rep.

I was trying to track down why the output of my Node.js selenium scripts were generating the following statements: "A device attached to the system is not functioning. (0x1F)" and how to prevent those warnings from showing up in my output.

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33909686) – SiKing Feb 28 '23 at 22:04