title: How to stub an API when testing with Selenium Server
body: <p>I'm using Nightwatch.js to test a MERN stack application—it makes calls to the Twilio API when it receives a <code>POST</code> request at <code>/sms/outgoing/</code>. </p>
  
  <p>I would rather not send SMS messages every time I run my e2e tests—instead I'd like to stub out the behaviour and, ideally, return the request data, so that I can check my app is submitting the correct info.</p>
  
  <p>I have looked at libraries such as <a href="https://github.com/node-nock/nock" rel="nofollow noreferrer">nock</a> and <a href="https://github.com/wheresrhys/fetch-mock" rel="nofollow noreferrer">fetch-mock</a>, but neither of these will work with tests that rely on selenium.</p>
  
  <p>Is there a library that can intercept requests made by Selenium Server and provide the stubbing behaviour I'm after?</p>