共用方式為


SetProperty 函式

適用於: 畫布應用程式 模型導向應用程式

SetProperty 函式模擬與輸入控制項的互動,就像使用者已在控制項中輸入或設定值一樣。 只有當您在 Power Apps Test Studio 中撰寫測試時才能使用此函式。 您可以使用 SetProperty 函式設定下列屬性。

重要

Assert 函式僅適用於 Power Apps 中的 Test Studio。

語法

SetProperty(Control Property, value)

  • Control Property - 必要項目。 代表使用者設定的控制項屬性。
  • Value - 必要項目。 要代表使用者設定的屬性值。

範例

控制​​ 屬性 範例運算式
TextInput 文字 SetProperty(TextInput1.Text, "Sample text")
RichTextEditor HtmlText SetProperty(RichTextEditor1.HtmlText, "<p>Sample text</p>")
切換 SetProperty(Toggle1.Value, false)
核取方塊 SetProperty(Checkbox1.Value, false)
滑桿 SetProperty(Slider1.Value, 10)
評分 SetProperty(Rating1.Value, 5)
日期選擇器 SelectedDate SetProperty(DatePicker1.SelectedDate, Date(2020,3,10))
選項 已選取 SetProperty(Radio1.Selected, "Yes")
選項 SelectedText SetProperty(Radio1.SelectedText, "Yes")
下拉式清單 已選取 SetProperty(Dropdown1.Selected, {Value:"Sample value"})
下拉式清單 SelectedText SetProperty(Dropdown1.SelectedText, {Value:"Sample value"})
下拉式方塊 已選取 SetProperty(Dropdown1.Selected, {Value:"Sample value"})
下拉式方塊 選取的項目 SetProperty(ComboBox1.SelectedItems, Table({Value:"Sample value"},({Value:"Sample value"}))
ListBox 已選取 SetProperty(Listbox1.Selected, {'Value':"Sample value"})
ListBox 選取的項目 SetProperty(Listbox1.SelectedItems, Table({Value:"Sample value"},({Value:"Sample value"}))

請參閱

Test Studio 概觀
使用 Test Studio