Element Cookbook
Control-by-control snippets, organised by category. Each shows the original FlaUI C# call (from the FlaUI UITests) and its Python equivalent. For full, runnable suites that string these together, see the Examples overview.
All snippets assume a window (an automation element / Window) and a condition factory cf — see
any example suite for how to obtain them.
Interactive controls
Button
CheckBox
RadioButton
var radio = window.FindFirstDescendant(cf => cf.ByAutomationId("RadioButton1"))?.AsRadioButton();
radio.IsChecked = true;
radio = window.find_first_descendant(cf.by_automation_id("RadioButton1")).as_radio_button()
radio.is_checked = True
ComboBox
var combo = window.FindFirstDescendant(cf => cf.ByAutomationId("Countries"))?.AsComboBox();
combo.Select("India");
combo = window.find_first_descendant(cf.by_automation_id("Countries")).as_combo_box()
combo.select("India")
TextBox
var textBox = window.FindFirstDescendant(cf => cf.ByAutomationId("TextBox"))?.AsTextBox();
textBox.Text = "hello";
text_box = window.find_first_descendant(cf.by_automation_id("TextBox")).as_text_box()
text_box.text = "hello"
Slider
var slider = window.FindFirstDescendant(cf => cf.ByAutomationId("Slider"))?.AsSlider();
slider.Value = 7;
Containers
ListBox
var listBox = window.FindFirstDescendant(cf => cf.ByAutomationId("ListBox"))?.AsListBox();
listBox.Select(0);
list_box = window.find_first_descendant(cf.by_automation_id("ListBox")).as_list_box()
list_box.select(0)
Tree
var tree = window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Tree))?.AsTree();
var node = tree.Items[0];
node.Expand();
tree = window.find_first_descendant(cf.by_control_type(ControlType.Tree)).as_tree()
node = tree.items[0]
node.expand()
Grid / DataGrid
var grid = window.FindFirstDescendant(cf => cf.ByControlType(ControlType.DataGrid))?.AsGrid();
var cell = grid.Rows[0].Cells[1];
grid = window.find_first_descendant(cf.by_control_type(ControlType.DataGrid)).as_grid()
cell = grid.rows[0].cells[1]
Tab
var tab = window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Tab))?.AsTab();
tab.SelectTabItem("Complex Controls");
tab = window.find_first_descendant(cf.by_control_type(ControlType.Tab)).as_tab()
tab.select_tab_item(value="Complex Controls") # or select_tab_item(index=1)
Display
Label
var label = window.FindFirstDescendant(cf => cf.ByAutomationId("Label"))?.AsLabel();
var text = label.Text;
ProgressBar
var bar = window.FindFirstDescendant(cf => cf.ByAutomationId("ProgressBar"))?.AsProgressBar();
var value = bar.Value;
bar = window.find_first_descendant(cf.by_automation_id("ProgressBar")).as_progress_bar()
value = bar.value