DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceremovePAGE ELEMENTSWrite and magicaddText elementsaddData elementsaddChart elementsaddInput widgetsaddMedia elementsaddLayouts and containersaddChat elementsaddStatus elementsaddThird-party componentsopen_in_newAPPLICATION LOGICNavigation and pagesaddExecution flowaddCaching and stateaddConnections and secretsaddCustom componentsaddUtilitiesaddConfigurationaddTOOLSApp testingremovest.testing.v1.AppTestTesting element classesCommand lineaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Develop/API reference/App testing/Testing element classesTesting element classes
st.testing.v1.element_tree.Block
The Block class has the same methods and attributes as AppTest. A Block instance represents a container of elements just as AppTest represents the entire app. For example, Block.button will produce a WidgetList of Button in the same manner as AppTest.button.
ChatMessage, Column, and Tab all inherit from Block. For all container classes, parameters of the original element can be obtained as properties. For example, ChatMessage.avatar and Tab.label.
st.testing.v1.element_tree.ElementStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeElement base class for testing.
This class's methods and attributes are universal for all elements
implemented in testing. For example, Caption, Code, Text, and
Title inherit from Element. All widget classes also
inherit from Element, but have additional methods specific to each
widget type. See the AppTest class for the full list of supported
elements.
For all element classes, parameters of the original element can be obtained
as properties. For example, Button.label, Caption.help, and
Toast.icon.
Class description[source] st.testing.v1.element_tree.Element(proto, root) Methods

run(*, timeout=None)
 
Run the AppTest script which contains the element.
Attributes

value
 
The value or contents of the element.

st.testing.v1.element_tree.ButtonStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.button and st.form_submit_button.
Class description[source] st.testing.v1.element_tree.Button(proto, root) Methods

click()
 
Set the value of the button to True.


run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the value of the button.
Attributes

value
 
The value of the button. (bool)

st.testing.v1.element_tree.ChatInputStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.chat_input.
Class description[source] st.testing.v1.element_tree.ChatInput(proto, root) Methods

run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the value of the widget.
Attributes

value
 
The value of the widget. (str)

st.testing.v1.element_tree.CheckboxStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.checkbox.
Class description[source] st.testing.v1.element_tree.Checkbox(proto, root) Methods

check()
 
Set the value of the widget to True.


run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the value of the widget.


uncheck()
 
Set the value of the widget to False.
Attributes

value
 
The value of the widget. (bool)

st.testing.v1.element_tree.ColorPickerStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.color_picker.
Class description[source] st.testing.v1.element_tree.ColorPicker(proto, root) Methods

pick(v)
 
Set the value of the widget as a hex string. May omit the "#" prefix.


run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the value of the widget as a hex string.
Attributes

value
 
The currently selected value as a hex string. (str)

st.testing.v1.element_tree.DateInputStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.date_input.
Class description[source] st.testing.v1.element_tree.DateInput(proto, root) Methods

run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the value of the widget.
Attributes

value
 
The value of the widget. (date or Tuple of date)

st.testing.v1.element_tree.MultiselectStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.multiselect.
Class description[source] st.testing.v1.element_tree.Multiselect(proto, root) Methods

run(*, timeout=None)
 
Run the AppTest script which contains the element.


select(v)
 
Add a selection to the widget. Do nothing if the value is already selected.        If testing a multiselect widget with repeated options, use set_value        instead.


set_value(v)
 
Set the value of the multiselect widget. (list)


unselect(v)
 
Remove a selection from the widget. Do nothing if the value is not        already selected. If a value is selected multiple times, the first        instance is removed.
Attributes

format_func
 
The widget's formatting function for displaying options. (callable)


indices
 
The indices of the currently selected values from the options. (list)


value
 
The currently selected values from the options. (list)

st.testing.v1.element_tree.NumberInputStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.number_input.
Class description[source] st.testing.v1.element_tree.NumberInput(proto, root) Methods

decrement()
 
Decrement the st.number_input widget as if the user clicked "-".


increment()
 
Increment the st.number_input widget as if the user clicked "+".


run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the value of the st.number_input widget.
Attributes

value
 
Get the current value of the st.number_input widget.

st.testing.v1.element_tree.RadioStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.radio.
Class description[source] st.testing.v1.element_tree.Radio(proto, root) Methods

run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the selection by value.
Attributes

format_func
 
The widget's formatting function for displaying options. (callable)


index
 
The index of the current selection. (int)


value
 
The currently selected value from the options. (Any)

st.testing.v1.element_tree.SelectSliderStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.select_slider.
Class description[source] st.testing.v1.element_tree.SelectSlider(proto, root) Methods

run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_range(lower, upper)
 
Set the ranged selection by values.


set_value(v)
 
Set the (single) selection by value.
Attributes

format_func
 
The widget's formatting function for displaying options. (callable)


value
 
The currently selected value or range. (Any or Sequence of Any)

st.testing.v1.element_tree.SelectboxStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.selectbox.
Class description[source] st.testing.v1.element_tree.Selectbox(proto, root) Methods

run(*, timeout=None)
 
Run the AppTest script which contains the element.


select(v)
 
Set the selection by value.


select_index(index)
 
Set the selection by index.


set_value(v)
 
Set the selection by value.
Attributes

format_func
 
The widget's formatting function for displaying options. (callable)


index
 
The index of the current selection. (int)


value
 
The currently selected value from the options. (Any)

st.testing.v1.element_tree.SliderStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.slider.
Class description[source] st.testing.v1.element_tree.Slider(proto, root) Methods

run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_range(lower, upper)
 
Set the ranged value of the slider.


set_value(v)
 
Set the (single) value of the slider.
Attributes

value
 
The currently selected value or range. (Any or Sequence of Any)

st.testing.v1.element_tree.TextAreaStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.text_area.
Class description[source] st.testing.v1.element_tree.TextArea(proto, root) Methods

input(v)
 
Set the value of the widget only if the value does not exceed the        maximum allowed characters.


run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the value of the widget.
Attributes

value
 
The current value of the widget. (str)

st.testing.v1.element_tree.TextInputStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.text_input.
Class description[source] st.testing.v1.element_tree.TextInput(proto, root) Methods

input(v)
 
Set the value of the widget only if the value does not exceed the        maximum allowed characters.


run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the value of the widget.
Attributes

value
 
The current value of the widget. (str)

st.testing.v1.element_tree.TimeInputStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.time_input.
Class description[source] st.testing.v1.element_tree.TimeInput(proto, root) Methods

decrement()
 
Select the previous available time.


increment()
 
Select the next available time.


run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the value of the widget.
Attributes

value
 
The current value of the widget. (time)

st.testing.v1.element_tree.ToggleStreamlit VersionVersion 1.34.0Version 1.33.0Version 1.32.0Version 1.31.0Version 1.30.0Version 1.29.0Version 1.28.0Version 1.27.0Version 1.26.0Version 1.25.0Version 1.24.0Version 1.23.0Version 1.22.0Version 1.21.0Version 1.20.0Version 1.19.0Version 1.18.0Version 1.17.0Version 1.16.0Version 1.15.0Version 1.14.0Version 1.13.0Streamlit in SnowflakeA representation of st.toggle.
Class description[source] st.testing.v1.element_tree.Toggle(proto, root) Methods

run(*, timeout=None)
 
Run the AppTest script which contains the element.


set_value(v)
 
Set the value of the widget.
Attributes

value
 
The current value of the widget. (bool)
Previous: st.testing.v1.AppTestNext: Command lineforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy