Tungsten v0.1.0 Tungsten.CDP.Emulation View Source

Emulation

This domain emulates different environments for the page.

Link to this section Summary

Functions

Link to this section Types

Link to this type

cdp_screen_orientation_type() View Source
cdp_screen_orientation_type() :: %{
  type:
    :landscape_secondary
    | :landscape_primary
    | :portrait_secondary
    | :portrait_primary,
  angle: integer()
}

Emulation.ScreenOrientation

Screen orientation.

Link to this type

cdp_virtual_time_policy_type() View Source
cdp_virtual_time_policy_type() ::
  :pause_if_network_fetches_pending | :pause | :advance

Emulation.VirtualTimePolicy

advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to allow the next delayed task (if any) to run; pause: The virtual time base may not advance; pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending resource fetches.

Link to this section Functions

Link to this function

can_emulate(session, parameters \\ %{}, options \\ []) View Source
can_emulate(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
  {:ok, %{result: boolean()}} | {:error, term()}

Emulation.canEmulate

Tells whether emulation is supported.

Link to this function

clear_device_metrics_override(session, parameters \\ %{}, options \\ []) View Source
clear_device_metrics_override(
  GenServer.server(),
  map(),
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.clearDeviceMetricsOverride

Clears the overriden device metrics.

Link to this function

clear_geolocation_override(session, parameters \\ %{}, options \\ []) View Source
clear_geolocation_override(
  GenServer.server(),
  map(),
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.clearGeolocationOverride

Clears the overriden Geolocation Position and Error.

Link to this function

reset_page_scale_factor(session, parameters \\ %{}, options \\ []) View Source
reset_page_scale_factor(
  GenServer.server(),
  map(),
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.resetPageScaleFactor

Requests that page scale factor is reset to initial values.

Link to this function

set_cpu_throttling_rate(session, parameters, options \\ []) View Source
set_cpu_throttling_rate(
  GenServer.server(),
  %{rate: integer() | float()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setCPUThrottlingRate

Enables CPU throttling to emulate slow CPUs.

Link to this function

set_default_background_color_override(session, parameters \\ %{}, options \\ []) View Source
set_default_background_color_override(
  GenServer.server(),
  %{optional(:color) => Tungsten.CDP.DOM.cdp_rgba_type()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setDefaultBackgroundColorOverride

Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.

Link to this function

set_device_metrics_override(session, parameters, options \\ []) View Source
set_device_metrics_override(
  GenServer.server(),
  %{
    :width => integer(),
    :height => integer(),
    :device_scale_factor => integer() | float(),
    :mobile => boolean(),
    optional(:scale) => integer() | float(),
    optional(:screen_width) => integer(),
    optional(:screen_height) => integer(),
    optional(:position_x) => integer(),
    optional(:position_y) => integer(),
    optional(:dont_set_visible_size) => boolean(),
    optional(:screen_orientation) => cdp_screen_orientation_type(),
    optional(:viewport) => Tungsten.CDP.Page.cdp_viewport_type()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setDeviceMetricsOverride

Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results).

Link to this function

set_emit_touch_events_for_mouse(session, parameters, options \\ []) View Source
set_emit_touch_events_for_mouse(
  GenServer.server(),
  %{:enabled => boolean(), optional(:configuration) => :desktop | :mobile},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setEmitTouchEventsForMouse

This command has no documentation

Link to this function

set_emulated_media(session, parameters, options \\ []) View Source
set_emulated_media(
  GenServer.server(),
  %{media: String.t()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setEmulatedMedia

Emulates the given media for CSS media queries.

Link to this function

set_focus_emulation_enabled(session, parameters, options \\ []) View Source
set_focus_emulation_enabled(
  GenServer.server(),
  %{enabled: boolean()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setFocusEmulationEnabled

Enables or disables simulating a focused and active page.

Link to this function

set_geolocation_override(session, parameters \\ %{}, options \\ []) View Source
set_geolocation_override(
  GenServer.server(),
  %{
    optional(:latitude) => integer() | float(),
    optional(:longitude) => integer() | float(),
    optional(:accuracy) => integer() | float()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setGeolocationOverride

Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.

Link to this function

set_navigator_overrides(session, parameters, options \\ []) View Source
set_navigator_overrides(
  GenServer.server(),
  %{platform: String.t()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setNavigatorOverrides

Overrides value returned by the javascript navigator object.

Link to this function

set_page_scale_factor(session, parameters, options \\ []) View Source
set_page_scale_factor(
  GenServer.server(),
  %{page_scale_factor: integer() | float()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setPageScaleFactor

Sets a specified page scale factor.

Link to this function

set_script_execution_disabled(session, parameters, options \\ []) View Source
set_script_execution_disabled(
  GenServer.server(),
  %{value: boolean()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setScriptExecutionDisabled

Switches script execution in the page.

Link to this function

set_scrollbars_hidden(session, parameters, options \\ []) View Source
set_scrollbars_hidden(
  GenServer.server(),
  %{hidden: boolean()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setScrollbarsHidden

This command has no documentation

Link to this function

set_touch_emulation_enabled(session, parameters, options \\ []) View Source
set_touch_emulation_enabled(
  GenServer.server(),
  %{:enabled => boolean(), optional(:max_touch_points) => integer()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setTouchEmulationEnabled

Enables touch on platforms which do not support them.

Link to this function

set_user_agent_override(session, parameters, options \\ []) View Source
set_user_agent_override(
  GenServer.server(),
  %{
    :user_agent => String.t(),
    optional(:accept_language) => String.t(),
    optional(:platform) => String.t()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setUserAgentOverride

Allows overriding user agent with the given string.

Link to this function

set_virtual_time_policy(session, parameters, options \\ []) View Source
set_virtual_time_policy(
  GenServer.server(),
  %{
    :policy => cdp_virtual_time_policy_type(),
    optional(:budget) => integer() | float(),
    optional(:max_virtual_time_task_starvation_count) => integer(),
    optional(:wait_for_navigation) => boolean(),
    optional(:initial_virtual_time) =>
      Tungsten.CDP.Network.cdp_time_since_epoch_type()
  },
  Tungsten.Connection.exec_options()
) :: {:ok, %{virtual_time_ticks_base: integer() | float()}} | {:error, term()}

Emulation.setVirtualTimePolicy

Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets the current virtual time policy. Note this supersedes any previous time budget.

Link to this function

set_visible_size(session, parameters, options \\ []) View Source
set_visible_size(
  GenServer.server(),
  %{width: integer(), height: integer()},
  Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}

Emulation.setVisibleSize

Resizes the frame/viewport of the page. Note that this does not affect the frame's container (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported on Android.