Playwright.Page (playwright v0.1.1-preview) View Source

Playwright.Page represents a web page loaded in the Playwright browser server.

Selectors

Some functions in this module accept selectors:

  • By default, selectors are assumed to be CSS: a[href="/foo"]
  • If a selector starts with a single or double quote, it is a text selector: "Login"
  • If a selector starts with //, it is an xpath selector: //html/body

Selector types can be made explicit by prefixing with css=, text=, or xpath=: text="Login".

Playwright supports some useful pseudo-selectors:

  • text: #nav-bar :text("Contact us")
  • inclusion: .item-description:has(.item-promo-banner)
  • position: input:right-of(:text("Username")) (also left-of, above, below, near)
  • visibility: .login-button:visible
  • nth match: :nth-match(:text("Buy"), 3)
  • match any of the conditions: :is(button:has-text("Log in"), button:has-text("Sign in"))

More info on Playwright selectors is available online.

Link to this section Summary

Link to this section Types

Specs

t() :: %Playwright.Page{
  connection: term(),
  frames: term(),
  guid: term(),
  initializer: term(),
  listeners: term(),
  main_frame: term(),
  owned_context: term(),
  parent: term(),
  type: term()
}

Link to this section Functions

Link to this function

click(subject, selector)

View Source
Link to this function

evaluate(subject, expression, arg \\ nil)

View Source
Link to this function

evaluate_handle(subject, expression, arg \\ nil)

View Source
Link to this function

fill(subject, selector, value)

View Source
Link to this function

get_attribute(subject, selector, name)

View Source
Link to this function

on(subject, event, handler)

View Source
Link to this function

press(subject, selector, key)

View Source
Link to this function

query_selector(subject, selector)

View Source
Link to this function

query_selector!(subject, selector)

View Source
Link to this function

query_selector_all(subject, selector)

View Source
Link to this function

screenshot(subject, params)

View Source
Link to this function

set_content(subject, content)

View Source
Link to this function

set_viewport_size(subject, params)

View Source
Link to this function

text_content(subject, selector)

View Source
Link to this function

wait_for_selector(subject, selector, options \\ %{})

View Source