title: Handling webdriverio timeouts
body: <p>Here's what I want to accomplish:</p>
  <pre><code>check if element &quot;Error&quot; span exists
       then do something if it does ===
  else check if element &quot;el2&quot; span exists
        then do something ====
  else
        do something
  </code></pre>
  <p>Here's my code</p>
  <pre><code>let done = false;
  let errorOccured = false;
  let isManualStep = false;
  do {
      try {
          console.log('Checking span.label-red=Error...................')
          let errorStepExists = $('span.label-red=Error').isExisting();
          if (errorStepExists) {
              console.log('Error encountered...................')
  
              done = true;
          }
      } else {
          console.log('Error not encountered...................')
          let el2Exists = $('span&gt;td.col-md-2=Waiting').isExisting();
          if (mel2Exists) {
              console.log('Encountered...................')
          }
      } catch (e) {
          console.log(e);
      }
  }
  while (!done);
  </code></pre>
  <p>It doesn't seem to go to the catch block if element doesn't exist and it fails my test instead with a timeout error.</p>
  <p>Error: Timeout of 20000ms exceeded. The execution in the test &quot;xxxxxx&quot; took too long. Try to reduce the run time or increase your timeout for test specs (<a href="https://webdriver.io/docs/timeouts.html" rel="nofollow noreferrer">https://webdriver.io/docs/timeouts.html</a>).</p>