drag_to: Page class: Drag and drop an element

View source: R/actions.R

drag_toR Documentation

Page class: Drag and drop an element

Description

The drag_to function performs a drag and drop operation from the source element to the target element. It can either locate the elements using provided selectors or by referencing elements previously located.

Usage

drag_to(page_df, to_elem_id, selector = NULL)

Arguments

page_df

A data frame containing page information, including the page_id column. This data frame is used to identify the page object where the drag and drop operation should be performed.

to_elem_id

A character string representing the elem_id of the target element.

selector

(Optional) A character string representing the selector of the source element. If provided, the source element will be located using the selector. If not provided, the elem_id column from page_df will be used to reference a previously located element.

Value

The updated page_df data frame.

Examples

# Create a page_df data frame
page_df <- data.frame(page_id = "my_page")

# Drag and drop an element using selectors
drag_to(page_df, to_elem_id = "myTargetElement", selector = "#mySourceElement")

# Drag and drop an element using previously located elements
page_df <- get_by_text(page_df, "Drag Me")
page_df <- get_by_text(page_df, "Drop Here")
drag_to(page_df, to_elem_id = page_df$elem_id[2])


benjaminguinaudeau/playwrightr documentation built on Nov. 8, 2023, 8:36 p.m.