docs: function waitForDocumentState(self, state, timeout) {
    let expr;
    timeout = timeout || 8000;
  
    switch (state) {
      case 'interactive':
        expr =
          "document.readyState === 'interactive' || document.readyState === 'complete'";
        break;
      case 'complete':
        expr = "document.readyState === 'complete'";
        break;
      default:
        throw new Error(
          'Document state doesn\'t match "interactive" or "complete"'
        );
    }
  
    self.setAsyncScriptTimeout(timeout + 250);
    return self.waitForConditionInBrowser(expr, timeout);
  }