docs: function _waitForElement(browser, selector, asserter, timeout, pollFreq) {
    /* eslint no-use-before-define:0 */
    timeout = timeout || 2000;
    pollFreq = pollFreq || 50;
  
    const endTime = Date.now() + timeout;
  
    function attempt() {
      const element = browser.elementByCssSelectorOrNull(selector);
      return element
        .then(asserter.assert)
        .catch(retry)
        .then(_.constant(element));
    }
  
    function retry(error) {
      if (!error.retriable) {
        throw error;
      }
      if (Date.now() >= endTime) {
        error.message = `Timeout (${timeout}ms): ${error.message}`;
        throw error;
      }
      return new Promise(resolve => setTimeout(resolve, pollFreq)).then(attempt);
    }
  
    return attempt();
  }