Widget: A Shiny Widget

WidgetR Documentation

A Shiny Widget

Description

A Widget object represents a Shiny input or output control, and provides methods for finer grained interaction.

Methods

Public methods


Method new()

Create new Widget

Usage
Widget$new(name, element, type, iotype = c("input", "output"))
Arguments
name

Name of a Shiny widget.

element

webdriver::Element

type

Widget type

iotype

Input/output type.


Method getName()

Control id (i.e. inputId or outputId that control was created with).

Usage
Widget$getName()

Method getElement()

Underlying webdriver::Element() object.

Usage
Widget$getElement()

Method getHtml()

retrieve the underlying HTML for a widget

Usage
Widget$getHtml()

Method getType()

Widget type, e.g. textInput, selectInput.

Usage
Widget$getType()

Method getIoType()

Is this an input or output control?

Usage
Widget$getIoType()

Method isInput()

Is this an input control?

Usage
Widget$isInput()

Method isOutput()

Is this an output control?

Usage
Widget$isOutput()

Method getValue()

Get current value of control.

Usage
Widget$getValue()

Method setValue()

Set value of control.

Usage
Widget$setValue(value)
Arguments
value

Value to set for the widget.


Method click()

scrolls the element into view, then clicks the in-view centre point of it.

Usage
Widget$click()
Returns

self, invisibly.


Method sendKeys()

Send specified key presses to control.

Usage
Widget$sendKeys(keys)
Arguments
keys

Keys to send to the widget or the app. See webdriver::key for how to specific special keys.


Method listTabs()

Lists the tab names of a shiny::tabsetPanel(). It fails for other types of widgets.

Usage
Widget$listTabs()

Method uploadFile()

Upload a file to a shiny::fileInput(). It fails for other types of widgets.

Usage
Widget$uploadFile(filename)
Arguments
filename

Path to file to upload


Method clone()

The objects of this class are cloneable with this method.

Usage
Widget$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


rstudio/shinytest documentation built on March 5, 2024, 5:12 a.m.