title: How to access Selenium's logs with JavaScript Webdriver to view network requests
body: <p>I'm trying to open a website and view all the network requests the page sends. I can see in the documentation (<a href="http://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/logging.html" rel="nofollow noreferrer">here</a>) this code snippet:</p>
  <pre><code>var prefs = new logging.Preferences();
   prefs.setLevel(logging.Type.BROWSER, logging.Level.DEBUG);
  
   var caps = Capabilities.chrome();
   caps.setLoggingPrefs(prefs);
   // ...
  </code></pre>
  <p>but I do not get where I'm supposed to get logging and capabilities from and cannot find any examples of this in Javascript.</p>
  <p>This is what I have so far:</p>
  <pre><code>var chromedriver = require('chromedriver');
  
  var webdriver = require('selenium-webdriver'),
      By = webdriver.By,
      until = webdriver.until;
  
  async function LibraryAppTest() {
      let driver = new webdriver.Builder().forBrowser('chrome').withCapabilities({'browserName': 'chrome'}).build();
  
      await driver.get('http://library-app.firebaseapp.com');
      await driver.findElement(By.css('input'));
      await driver.findElement(By.css('.btn-lg')).getText().then(function(text){
          console.log(&quot;Button Text: &quot; + text);
      });
      await driver.quit();
  }
  
  LibraryAppTest()
  .then(_ =&gt; console.log('SUCCESS!'), e =&gt; console.error('FAILURE: ' + e));
  </code></pre>
  <p>This works as is, I just can't understand how I'm supposed to set up the logging preferences and use them to see the network calls the page makes.</p>