Current section
Files
Jump to
Current section
Files
lib/bibbidi/commands/input.ex
# Generated by mix bibbidi.gen — do not edit manually
defmodule Bibbidi.Commands.Input do
@moduledoc """
Command builders for the `input` module of the WebDriver BiDi protocol.
"""
alias Bibbidi.Connection
alias __MODULE__.PerformActions
alias __MODULE__.ReleaseActions
alias __MODULE__.SetFiles
alias __MODULE__.FileDialogOpened
@doc "Executes the `input.performActions` command."
@spec perform_actions(
GenServer.server(),
Bibbidi.Types.BrowsingContext.t(),
[Bibbidi.Types.Input.SourceActions.t()],
PerformActions.opts()
) :: {:ok, PerformActions.result()} | {:error, term()}
def perform_actions(conn, context, actions, opts \\ []) do
{connection_mod, _opts} = Keyword.pop(opts, :connection_mod, Connection)
connection_mod.execute(
conn,
struct!(PerformActions, [{:context, context}, {:actions, actions}]),
[]
)
end
@doc "Executes the `input.releaseActions` command."
@spec release_actions(
GenServer.server(),
Bibbidi.Types.BrowsingContext.t(),
ReleaseActions.opts()
) :: {:ok, ReleaseActions.result()} | {:error, term()}
def release_actions(conn, context, opts \\ []) do
{connection_mod, _opts} = Keyword.pop(opts, :connection_mod, Connection)
connection_mod.execute(conn, struct!(ReleaseActions, [{:context, context}]), [])
end
@doc "Executes the `input.setFiles` command."
@spec set_files(
GenServer.server(),
Bibbidi.Types.BrowsingContext.t(),
Bibbidi.Types.Script.SharedReference.t(),
[String.t()],
SetFiles.opts()
) :: {:ok, SetFiles.result()} | {:error, term()}
def set_files(conn, context, element, files, opts \\ []) do
{connection_mod, _opts} = Keyword.pop(opts, :connection_mod, Connection)
connection_mod.execute(
conn,
struct!(SetFiles, [{:context, context}, {:element, element}, {:files, files}]),
[]
)
end
@doc """
Executes the `input.fileDialogOpened` command.
## Options
#{Zoi.describe(FileDialogOpened.opts_schema())}
"""
@spec file_dialog_opened(
GenServer.server(),
Bibbidi.Types.BrowsingContext.t(),
boolean(),
FileDialogOpened.opts()
) :: {:ok, FileDialogOpened.result()} | {:error, term()}
def file_dialog_opened(conn, context, multiple, opts \\ []) do
{connection_mod, opts} = Keyword.pop(opts, :connection_mod, Connection)
opts = Zoi.parse!(FileDialogOpened.opts_schema(), opts)
connection_mod.execute(
conn,
struct!(FileDialogOpened, [{:context, context}, {:multiple, multiple} | opts]),
[]
)
end
end