Element

net.ruippeixotog.scalascraper.model.Element
See theElement companion object
trait Element

A representation of a HTML DOM element.

Elements can be obtained by obtaining Document instances (for example, through a net.ruippeixotog.scalascraper.browser.Browser) and using one of its several methods. They provide several methods for traversing and retrieving infomation from the DOM of the page in which they are.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Type members

Types

type ThisType <: Element

The concrete type of this Element. Should be defined in each concrete implementation as its own type.

The concrete type of this Element. Should be defined in each concrete implementation as its own type.

Attributes

Value members

Abstract methods

def attr(name: String): String

Returns the value associated with an attribute of this element.

Returns the value associated with an attribute of this element.

Value parameters

name

the name of the attribute

Attributes

Returns

the value associated with the given attribute.

def attrs: Map[String, String]

The map of attributes of this element.

The map of attributes of this element.

Attributes

def childNodes: Iterable[Node]

The list of child nodes of this element.

The list of child nodes of this element.

Attributes

def children: Iterable[ThisType]

The list of children of this element.

The list of children of this element.

Attributes

def hasAttr(name: String): Boolean

Checks if an attribute is defined in this element.

Checks if an attribute is defined in this element.

Value parameters

name

the name of the attribute

Attributes

Returns

true if the attribute is defined, false otherwise

def innerHtml: String

The HTML representation of the content inside this element as a string.

The HTML representation of the content inside this element as a string.

Attributes

def outerHtml: String

The HTML representation of this element as a string.

The HTML representation of this element as a string.

Attributes

def ownText: String

The text content owned by this element only, i.e. without text inside children.

The text content owned by this element only, i.e. without text inside children.

Attributes

def parent: Option[ThisType]

The element of this element.

The element of this element.

Attributes

def select(query: String): ElementQuery[ThisType]

Executes a query on this element using a CSS selector.

Executes a query on this element using a CSS selector.

Value parameters

query

the CSS selector used to select elements to be returned

Attributes

Returns

an ElementQuery instance representing the sequence of resulting elements

def siblingNodes: Iterable[Node]

The list of sibling nodes of this element.

The list of sibling nodes of this element.

Attributes

def siblings: Iterable[ThisType]

The list of siblings of this element.

The list of siblings of this element.

Attributes

def tagName: String

The tag name of this element.

The tag name of this element.

Attributes

def text: String

The text content inside this element and any child nodes.

The text content inside this element and any child nodes.

Attributes