loadFromString method

bool loadFromString(
  1. String responseBodyAsString
)

Loads a webpage that was previously loaded and stored as a String by using getPageContent. This operation is synchronous and returns a true bool once the string has been loaded and is ready to be queried by either getElement, getElementTitle or getElementAttribute.

Implementation

bool loadFromString(String responseBodyAsString) {
  try {
    // Parses the response body once it's retrieved to be used on the other methods.
    _document = parse(responseBodyAsString);
  } catch (e) {
    throw WebScraperException(e.toString());
  }
  return true;
}