Пример #1
0
  /**
   * Parse the current web page from the WebDriver
   *
   * @param driver
   * @throws Exception
   */
  public HTML(WebDriver driver) throws Exception {
    // Initialize the variables
    initialize();

    // Set the reader to use a string which comes from the current web page
    reader = new StringReader(driver.getPageSource());

    // Initialize the parser
    parser = new HtmlParser(uacontext, doc);

    // Use the Cobra HTML parser
    parser.parse(reader);
  }
Пример #2
0
  /**
   * Parse using given file
   *
   * @param file
   * @throws Exception
   */
  public HTML(File file) throws Exception {
    // Initialize the variables
    initialize();

    // Set the reader to use a file
    reader = new FileReader(file);

    // Initialize the parser
    parser = new HtmlParser(uacontext, doc);

    // Use the Cobra HTML parser
    parser.parse(reader);
  }
Пример #3
0
  /**
   * Parse using given text
   *
   * @param sText
   * @throws Exception
   */
  public HTML(String sText) throws Exception {
    // Initialize the variables
    initialize();

    // Set the reader to use a string
    reader = new StringReader(sText);

    // Initialize the parser
    parser = new HtmlParser(uacontext, doc);

    // Use the Cobra HTML parser
    parser.parse(reader);
  }