code: function () {
        var alert = getAlert();
        if (alert.isNil()) {
          throw new ERROR.NoAlertOpenError();
        }
  
        var texts = this.getElementsByType('text', alert);
        // If an alert does not have a title, alert.name() is null, use empty string
        var text = alert.name() || "";
        if (texts.length > 1) {
          // Safari alerts have the URL as a title
          if (text.indexOf('http') === 0 || text === "") {
            text = texts.last().name();
          } else {
            // go through all the text elements and concatenate
            text = null;
            for (var i = 0; i < texts.length; i++) {
              var subtext = texts[i].name();
              if (subtext) {
                // if there is text, append it, otherwise use sub text
                text = text ? text + ' ' + subtext : subtext;
              }
            }
          }
        } else if (parseFloat($.systemVersion) >= 9.3) {
          // iOS 9.3 Safari alerts only have one UIATextView
          texts = this.getElementsByType('UIATextView', alert);
          text = texts[0].name();
        }
        return text;
      }
docs: Alert-related functions