title: Python: How to hide output Chrome messages in Selenium?
body: <h2>What I want to do:</h2>
  
  <p>I want to open Chrome browser using Selenium ChromeDriver without the Chrome messages getting output to the console.</p>
  
  <h3>What I did:</h3>
  
  <pre><code>from selenium import webdriver
  driver = webdriver.Chrome(r'C:\Users\u1\Documents\scripts\chromedriver.exe')
  </code></pre>
  
  <h3>Output:</h3>
  
  <pre class="lang-none prettyprint-override"><code>C:\Users\u1\Documents\scripts&gt;python test.py
  
  DevTools listening on ws://127.0.0.1:50605/devtools/browser/11c9063a-44ce-4b39-9566-9e6c6270025c
  </code></pre>
  
  <p>I want to hide the output message "DevTools listening on..."</p>
  
  <h2>What I tried to solve this:</h2>
  
  <h3>Using contextlib</h3>
  
  <pre><code>from selenium import webdriver
  import contextlib
  
  with contextlib.redirect_stdout(None):
     driver = webdriver.Chrome(r'C:\Users\u1\Documents\scripts\chromedriver.exe')
  </code></pre>
  
  <h3>Using devnull</h3>
  
  <pre><code>from selenium import webdriver
  import subprocess
  
  devnull = subprocess.DEVNULL
  subprocess.Popen(open_browser(), stdout=devnull, stderr=devnull)
  def open_browser():
      driver = webdriver.Chrome(r'C:\Users\u1\Documents\scripts\chromedriver.exe')
  </code></pre>
  
  <h3>Using log-level=3</h3>
  
  <pre><code>chrome_options = Options()
  chrome_options.add_argument("--log-level=3")
  driver = webdriver.Chrome(r'C:\Users\u1\Documents\scripts\chromedriver.exe', chrome_options=chrome_options)
  </code></pre>
  
  <p>But still the message is getting displayed. How do I hide the output message "DevTools listening on..." in Python?</p>