Skip to content

Tab

flaui.core.automation_elements.Tab

Bases: AutomationElement

Class to interact with a tab element.

selected_tab_item_index property

The index of the currently selected TabItem

Returns:

Type Description
int

Selected index

tab_items property

All TabItem objects from this Tab

Returns:

Type Description
List[TabItem]

List of TabItem elements

select_tab_item(index=None, value=None, post_wait=None)

select_tab_item(
    index: int,
    value: None = None,
    post_wait: Optional[
        Union[bool, float, Callable[[], None]]
    ] = None,
) -> None
select_tab_item(
    index: None = None,
    value: str = ...,
    post_wait: Optional[
        Union[bool, float, Callable[[], None]]
    ] = None,
) -> None

Selects a TabItem by index

Parameters:

Name Type Description Default
index Optional[int]

Selects by index value

None
value Optional[str]

Selects by tab value

None
post_wait Optional[Union[bool, float, Callable[[], None]]]

Optional wait after operation. True=100ms, float=custom seconds, callable=custom function

None
Source code in flaui/core/automation_elements.py
@handle_csharp_exceptions
def select_tab_item(
    self,
    index: Optional[int] = None,
    value: Optional[str] = None,
    post_wait: Optional[Union[bool, float, Callable[[], None]]] = None,
) -> None:
    """Selects a TabItem by index

    :param index: Selects by index value
    :param value: Selects by tab value
    :param post_wait: Optional wait after operation. True=100ms, float=custom seconds, callable=custom function
    """
    from flaui.core.input import Mouse

    if index is None and value is None:
        raise ValueError("Either index or value have to be set for selected TabItem")
    try:
        self.raw_element.SelectTabItem(index) if index is not None else self.raw_element.SelectTabItem(value)
        Mouse._apply_post_wait(post_wait)
    except Exception as e:
        logging.error("Failed to select tab item: %s", e)

selected_tab_item()

The currently selected TabItem

Returns:

Type Description
TabItem

TabItem element

Source code in flaui/core/automation_elements.py
@handle_csharp_exceptions
def selected_tab_item(self) -> TabItem:
    """The currently selected TabItem

    :return: TabItem element
    """
    return TabItem(raw_element=self.raw_element.SelectedTabItem)