Packages
playwright
0.1.16-preview-1
1.49.1-alpha.2
1.49.1-alpha.1
1.44.0-alpha.4
1.44.0-alpha.3
1.44.0-alpha.2
1.44.0-alpha.1
1.18.0-alpha.1
0.1.17-preview-7
0.1.17-preview-6
0.1.17-preview-5
0.1.17-preview-4
0.1.17-preview-3
0.1.17-preview-2
0.1.17-preview-1
0.1.16-preview-3
0.1.16-preview-2
0.1.16-preview-1
0.1.1-preview
0.1.0-preview
Playwright is an Elixir library to automate Chromium, Firefox and WebKit browsers with a single API. Playwright delivers automation that is ever-green, capable, reliable and fast.
Current section
Files
Jump to
Current section
Files
lib/playwright/runner/channel/command.ex
defmodule Playwright.Runner.Channel.Command do
@moduledoc false
# `Command` represents an imperative sent to the Playwright server.
# The `id` is used to match reponses and reply to the caller with a `Response`.
alias Playwright.Runner.Channel.Command
@enforce_keys [:guid, :id, :method, :params]
@derive [Jason.Encoder]
defstruct [
:guid,
:id,
:method,
:params,
:metadata
]
@type t() :: %__MODULE__{
guid: binary(),
id: integer(),
method: binary(),
params: map()
}
# Creates a new `Command` struct. A monotonically-incremented `id` is added.
# This `id` is used to match `Response` messages to the `Command`. `params`
# are optional here and are passed to the Playwright server. They may actually
# be required for the server-side `method` to make sense.
def new(guid, method, params \\ %{}) do
%Command{
guid: guid,
id: System.unique_integer([:monotonic, :positive]),
method: method,
params: params,
metadata: %{}
}
end
end