maybe_click method

SapTransaction maybe_click(
  1. String field, {
  2. AbstractSelector? selector,
  3. String? lsdata,
  4. String? id,
  5. String? name,
  6. String? xpath,
  7. String? css,
  8. String? tag,
  9. String? className,
})

Implementation

SapTransaction maybe_click(String field,
    {AbstractSelector? selector,
    String? lsdata,
    String? id,
    String? name,
    String? xpath,
    String? css,
    String? tag,
    String? className}) {
  if (selector == null) {
    if (lsdata != null) {
      selector = SapDataField(lsdata);
    } else if (id != null) {
      selector = WithId(id);
    } else if (name != null) {
      selector = WithName(name);
    } else if (xpath != null) {
      selector = XPath(xpath);
    } else if (css != null) {
      selector = Css(css);
    }
  }

  if (selector == null) {
    throw Exception("No selector provided");
  }

  this.fields[field] = NoMaybeButton(selector);
  return this;
}