Mechanize v0.1.0 Mechanize.Page.Elementable protocol View Source

Protocol used to extract element data using Mechanize.Page.Element module.

To implement this protocol you have to implement a single function Mechanize.Page.Elementable.element/1.

Example

Implementation of Elementable for a Mechanize.Form:

defmodule Mechanize.Form do
  defstruct element: nil,
            fields: []
end

defimpl Mechanize.Page.Elementable, for: Mechanize.Form do
  def element(e), do: e.element
end

Link to this section Summary

Functions

Returns an Mechanize.Page.Element struct from elementable data.

Link to this section Types

Link to this section Functions

Specs

element(any()) :: Element.t()

Returns an Mechanize.Page.Element struct from elementable data.