click | R Documentation |
The click
function simulates a click on an element. It can either locate the element using a provided selector or by referencing an element previously located.
click(
page_df,
selector = NULL,
index = 1,
button = "left",
click_count = 1,
delay = 0,
force = FALSE,
modifiers = NULL,
no_wait_after = FALSE,
position = NULL,
timeout = 30000,
trial = FALSE
)
page_df |
A data frame containing page information, including the |
selector |
(Optional) A character string representing the selector of the element.
If provided, the element will be located using the selector. If not provided, the |
button |
(Optional) A character string representing the button to use for the click. Possible values are "left", "right", or "middle". Defaults to "left". |
click_count |
(Optional) An integer representing the number of clicks to perform. Defaults to 1. |
delay |
(Optional) A float value representing the time to wait between mousedown and mouseup in milliseconds. Defaults to 0. |
force |
(Optional) A boolean value indicating whether to bypass the actionability checks. Defaults to false. |
modifiers |
(Optional) A list of modifier keys to press during the click. Possible values are "Alt", "Control", "Meta", and "Shift". If not specified, the currently pressed modifiers are used. |
no_wait_after |
(Optional) A boolean value indicating whether to wait for any subsequent navigations to happen. If set to true, it bypasses the waiting. Defaults to false. |
position |
(Optional) A dictionary specifying the x and y coordinates of the click relative to the top-left corner of the element's padding box. If not specified, some visible point of the element is used. |
timeout |
(Optional) A float value representing the maximum time in milliseconds for the click operation. Defaults to 30000 (30 seconds). Pass 0 to disable the timeout. |
trial |
(Optional) A boolean value indicating whether to perform the action or only perform the actionability checks without actually clicking. Defaults to false. |
The updated page_df
data frame.
# Create a page_df data frame
page_df <- data.frame(page_id = "my_page")
# Perform a click using a selector
click(page_df, selector = "#myElement", button = "left", click_count = 2, delay = 100, force = TRUE, modifiers = c("Control", "Shift"), no_wait_after = TRUE, position = list(x = 10, y = 10), timeout = 5000, trial = TRUE)
# Perform a click using a previously located element
page_df <- get_by_text(page_df, "Click Me")
click(page_df, button = "right")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.