Skip to contents

Mouse actions to be passed into actions_stream(). actions_mousedown() represents pressing a button on the mouse, while actions_mouseup() represents releasing a button. actions_mousemove() represents moving the mouse.

Usage

actions_mousedown(
  button = c("left", "right", "middle"),
  width = NULL,
  height = NULL,
  pressure = NULL,
  tangential_pressure = NULL,
  tilt_x = NULL,
  tilt_y = NULL,
  twist = NULL,
  altitude_angle = NULL,
  azimuth_angle = NULL
)

actions_mouseup(
  button = c("left", "right", "middle"),
  width = NULL,
  height = NULL,
  pressure = NULL,
  tangential_pressure = NULL,
  tilt_x = NULL,
  tilt_y = NULL,
  twist = NULL,
  altitude_angle = NULL,
  azimuth_angle = NULL
)

actions_mousemove(
  x,
  y,
  duration = NULL,
  origin = c("viewport", "pointer"),
  width = NULL,
  height = NULL,
  pressure = NULL,
  tangential_pressure = NULL,
  tilt_x = NULL,
  tilt_y = NULL,
  twist = NULL,
  altitude_angle = NULL,
  azimuth_angle = NULL
)

Arguments

button

The mouse button to press.

width

The 'width' of the click, a number.

height

The 'height' of the click, a number.

pressure

The amount of pressure to apply to the click: a number between 0 and 1.

tangential_pressure

A number between 0 and 1.

tilt_x

A whole number between -90 and 90.

tilt_y

A whole number between -90 and 90.

twist

A whole number between 0 and 359.

altitude_angle

A number between 0 and pi/2.

azimuth_angle

A number between 0 and 2*pi.

x

The x coordinate of the mouse movement.

y

The y coordinate of the mouse movement.

duration

The duration of the mouse movement, in seconds.

origin

The point from which x and y are measured. Can be a WebElement object, in which case x and y are measured from the center of the element.

Value

A selenium_action object.

Examples

actions_stream(
  actions_mousedown("left", width = 1, height = 1, pressure = 0.5),
  actions_mouseup("left", width = 100, height = 50, pressure = 1),
  actions_mousemove(x = 1, y = 1, duration = 1, origin = "pointer")
)
#> [[1]]
#> [[1]]$type
#> [1] "pointer"
#> 
#> [[1]]$id
#> [1] "80750"
#> 
#> [[1]]$actions
#> [[1]]$actions[[1]]
#> $type
#> [1] "pointerDown"
#> 
#> $button
#> [1] 0
#> 
#> $width
#> [1] 1
#> 
#> $height
#> [1] 1
#> 
#> $pressure
#> [1] 0.5
#> 
#> attr(,"class")
#> [1] "selenium_action"              "selenium_action_pointer"     
#> [3] "selenium_action_pointer_down"
#> 
#> [[1]]$actions[[2]]
#> $type
#> [1] "pointerUp"
#> 
#> $button
#> [1] 0
#> 
#> $width
#> [1] 100
#> 
#> $height
#> [1] 50
#> 
#> $pressure
#> [1] 1
#> 
#> attr(,"class")
#> [1] "selenium_action"            "selenium_action_pointer"   
#> [3] "selenium_action_pointer_up"
#> 
#> [[1]]$actions[[3]]
#> $type
#> [1] "pointerMove"
#> 
#> $x
#> [1] 1
#> 
#> $y
#> [1] 1
#> 
#> $duration
#> [1] 1000
#> 
#> $origin
#> [1] "pointer"
#> 
#> attr(,"class")
#> [1] "selenium_action"              "selenium_action_pointer"     
#> [3] "selenium_action_pointer_move"
#> 
#> 
#> 
#> attr(,"class")
#> [1] "selenium_actions_stream"