| elem_select {selenider} | R Documentation |
Select an HTML element
Description
Select or deselect select and option elements.
Usage
elem_select(
x,
value = NULL,
text = NULL,
index = NULL,
timeout = NULL,
reset_other = TRUE
)
Arguments
x |
A |
value |
If |
text |
The text content of the option to select. This does not have to be a complete match, and multiple options can be selected. |
index |
A vector of indexes. The nth option elements will be selected. |
timeout |
How long to wait for the element to exist. |
reset_other |
If |
Details
If no arguments apart from x are supplied, and x is a select element,
all options will be deselected.
Value
x, invisibly.
See Also
Other actions:
elem_click(),
elem_hover(),
elem_scroll_to(),
elem_set_value(),
elem_submit()
Examples
html <- "
<select multiple>
<option value='a'>Option A.</option>
<option value='b'>Option B.</option>
<option value='c'>Option C.</option>
</select>
"
session <- minimal_selenider_session(html)
s("select") |>
elem_select("a")
s("select") |>
elem_select(text = c("Option A.", "Option C."))
s("select") |>
elem_select(index = 2, reset_other = FALSE)
# Reset selection
s("select") |>
elem_select()
s("select") |>
elem_select("b")
[Package selenider version 0.4.0 Index]