R: Class for a Shiny widget

Widget {shinytest} | R Documentation

## Class for a Shiny widget

### Description

Class for a Shiny widget

### Usage

    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()

### Arguments

app

  A `ShinyDriver` object.

w

  A `Widget` object.

name

  Name of a Shiny widget.

iotype

  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

  Value to set for the widget. Its interpretation depends on the type of the widget, see details below.

keys

  Keys to send to the widget. See the `sendKeys` method of the `Element` class in the `webdriver` package.

### Details

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.

### Examples

    {

    }

[Package shinytest version 1.3.0 Index]