View Source Playwright.Page.Keyboard (playwright v1.44.0-alpha.4)
Keyboard
provides an API for managing a virtual keyboard. The high level API
is keyboard.type()
, which takes raw characters and generates proper
keydown
, keypress
/input
, and keyup
events on your page.
For finer control, you can use keyboard.down()
, keyboard.up()
, and
keyboard.insertText()
to manually fire events as if they were generated
from a real keyboard.
Examples
###
Summary
Functions
Optional callback implementation for Playwright.SDK.ChannelOwner.init/2
.
Types
Functions
@spec down(Playwright.Page.t(), binary()) :: Playwright.Page.t()
Optional callback implementation for Playwright.SDK.ChannelOwner.init/2
.
If implemented, the callback will receive:
- The newly created "channel owner" struct.
- The
:initializer
received from the Playwright browser server.
The implementation has the option of "patching" the struct as stored in the catalog, and/or binding event handlers.
Example
def init(%{session: session} = owner, _initializer) do
Channel.bind(session, {:guid, owner.guid}, :close, fn event ->
Logger.warning("Closing #{inspect(event.target)}")
end)
{:ok, %{owner | version: "1.2.3"}}
end
Returns
{:ok, struct()}
Arguments
key/name | type | description | |
---|---|---|---|
owner | param | struct() | The newly created channel owner (resource). |
initializer | param | struct() | The initializer received from with the channel owner instance was derived. |
@spec insert_text(Playwright.Page.t(), binary()) :: Playwright.Page.t()
@spec press(Playwright.Page.t(), binary()) :: Playwright.Page.t()
@spec type(Playwright.Page.t(), binary()) :: Playwright.Page.t()
@spec up(Playwright.Page.t(), binary()) :: Playwright.Page.t()