Class for a Shiny widget
w <- app$findWidget(name, iotype = c("auto", "input", "output"))
w$getName() w$getElement() w$getType() w$getIoType() w$isInput() w$isOutput()
w$getValue() w$setValue(value)
w$sendKeys(keys)
w$listTabs()
A ShinyDriver
object.
A Widget
object.
Name of a Shiny widget.
Character scalar, whether the widget is ‘input’ or ‘output’. The default ‘auto’ value works well, provided that widgets have unique names. (Shiny allows an input and an output widget with the same name.)
Value to set for the widget. Its interpretation depends on the type of the widget, see details below.
Keys to send to the widget. See the sendKeys
method of the Element
class in the
webdriver
package.
A Widget
object represents a Shiny input or output widget.
app$findWidget
creates a widget object from a
ShinyDriver
object.
w$getName()
returns the name of the widget.
w$getElement()
returns an HTML element. This is an
Element
object from the webdriver
package.
w$getType()
returns the type of the widget, possible values
are textInput
, selectInput
, etc.
w$getIoType()
returns ‘input’ or ‘output’,
whether the widget is an input or output widget.
w$isInput()
returns TRUE
for input widgets, FALSE
otherwise.
w$isOutput()
returns TRUE
for output widgets, FALSE
otherwise.
w$getValue()
returns the value of the widget. The exact type
returned depends on the type of the widget. TODO: list widgets and their
return types.
w$setValue()
sets the value of the widget, through the web
browser. Different widget types expect different different value
arguments. TODO: list widgets and types.
w$sendKeys
sends the specified keys to the HTML element of the
widget.
w$listTabs
lists the tab names of a tabsetPanel
widget.
It fails for other types of widgets.