Class/Object

net.ruippeixotog.scalascraper.browser

HtmlUnitBrowser

Related Docs: object HtmlUnitBrowser | package browser

Permalink

class HtmlUnitBrowser extends Browser

A Browser implementation based on HtmlUnit, a GUI-less browser for Java programs. HtmlUnitBrowser simulates thoroughly a web browser, executing JavaScript code in the pages besides parsing and modelling its HTML content. It supports several compatibility modes, allowing it to emulate browsers such as Internet Explorer.

Both the net.ruippeixotog.scalascraper.model.Document and the net.ruippeixotog.scalascraper.model.Element instances obtained from HtmlUnitBrowser can be mutated in the background. JavaScript code can at any time change attributes and the content of elements, reflected both in queries to Document and on previously stored references to Elements. The Document instance will always represent the current page in the browser's "window". This means the Document's location value can change, together with its root element, in the event of client-side page refreshes or redirections. However, Element instances belong to a fixed DOM tree and they stop being meaningful as soon as they are removed from the DOM or a client-side page reload occurs.

Linear Supertypes
Browser, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. HtmlUnitBrowser
  2. Browser
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new HtmlUnitBrowser(browserType: BrowserVersion = BrowserVersion.CHROME, proxy: ProxyConfig = null)

    Permalink

    browserType

    the browser type and version to simulate

Type Members

  1. type DocumentType = HtmlUnitDocument

    Permalink

    The concrete type of documents created by this browser.

    The concrete type of documents created by this browser.

    Definition Classes
    HtmlUnitBrowserBrowser

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clearCookies(): Unit

    Permalink

    Clears the cookie store of this browser.

    Clears the cookie store of this browser.

    Definition Classes
    HtmlUnitBrowserBrowser
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def closeAll(): Unit

    Permalink

    Closes all windows opened in this browser.

  8. def cookies(url: String): Map[String, String]

    Permalink

    Returns the current set of cookies stored in this browser for a given URL.

    Returns the current set of cookies stored in this browser for a given URL.

    url

    the URL whose stored cookies are to be returned

    returns

    a mapping of cookie names to their respective values.

    Definition Classes
    HtmlUnitBrowserBrowser
  9. def defaultClientSettings(client: WebClient): Unit

    Permalink
    Attributes
    protected[this]
  10. def defaultRequestSettings(req: WebRequest): Unit

    Permalink
    Attributes
    protected[this]
  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  13. def exec(req: WebRequest): HtmlUnitDocument

    Permalink
  14. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. def get(url: String): HtmlUnitDocument

    Permalink

    Retrieves and parses a web page using a GET request.

    Retrieves and parses a web page using a GET request.

    url

    the URL of the page to retrieve

    returns

    a Document containing the retrieved web page.

    Definition Classes
    HtmlUnitBrowserBrowser
  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. def parseFile(file: File, charset: String): HtmlUnitDocument

    Permalink

    Parses a local HTML file with a specified charset.

    Parses a local HTML file with a specified charset.

    file

    the HTML file to parse

    charset

    the charset of the file

    returns

    a Document containing the parsed web page.

    Definition Classes
    HtmlUnitBrowserBrowser
  23. def parseFile(path: String): DocumentType

    Permalink

    Parses a local HTML file encoded in UTF-8.

    Parses a local HTML file encoded in UTF-8.

    path

    the path in the local filesystem where the HTML file is located

    returns

    a Document containing the parsed web page.

    Definition Classes
    Browser
  24. def parseFile(path: String, charset: String): DocumentType

    Permalink

    Parses a local HTML file with a specified charset.

    Parses a local HTML file with a specified charset.

    path

    the path in the local filesystem where the HTML file is located

    charset

    the charset of the file

    returns

    a Document containing the parsed web page.

    Definition Classes
    Browser
  25. def parseFile(file: File): DocumentType

    Permalink

    Parses a local HTML file encoded in UTF-8.

    Parses a local HTML file encoded in UTF-8.

    file

    the HTML file to parse

    returns

    a Document containing the parsed web page.

    Definition Classes
    Browser
  26. def parseInputStream(inputStream: InputStream, charset: String): HtmlUnitDocument

    Permalink

    Parses an input stream with its content in a specified charset.

    Parses an input stream with its content in a specified charset. The provided input stream is always closed before this method returns or throws an exception.

    inputStream

    the input stream to parse

    charset

    the charset of the input stream content

    returns

    a Document containing the parsed web page.

    Definition Classes
    HtmlUnitBrowserBrowser
  27. def parseResource(name: String, charset: String = "UTF-8"): DocumentType

    Permalink

    Parses a resource with a specified charset.

    Parses a resource with a specified charset.

    name

    the name of the resource to parse

    charset

    the charset of the resource

    returns

    a Document containing the parsed web page.

    Definition Classes
    Browser
  28. def parseString(html: String): HtmlUnitDocument

    Permalink

    Parses an HTML string.

    Parses an HTML string.

    html

    the HTML string to parse

    returns

    a Document containing the parsed web page.

    Definition Classes
    HtmlUnitBrowserBrowser
  29. def post(url: String, form: Map[String, String]): HtmlUnitDocument

    Permalink

    Submits a form via a POST request and parses the resulting page.

    Submits a form via a POST request and parses the resulting page.

    url

    the URL of the page to retrieve

    form

    a map containing the form fields to submit with their respective values

    returns

    a Document containing the resulting web page.

    Definition Classes
    HtmlUnitBrowserBrowser
  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  31. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  32. lazy val underlying: WebClient

    Permalink
  33. def userAgent: String

    Permalink

    The user agent used by this browser to retrieve HTML pages from the web.

    The user agent used by this browser to retrieve HTML pages from the web.

    Definition Classes
    HtmlUnitBrowserBrowser
  34. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Browser

Inherited from AnyRef

Inherited from Any

Ungrouped