tc_window
Control the 1C:Enterprise client window for automated testing: activate or close windows, answer dialogs, execute commands, navigate pages, and read user messages or command interfaces.
Instructions
Actions on the client application window. Also available: tc_field(action="is_visible"), tc_field(action="is_enabled"), tc_field(action="get_context_menu"), tc_app(action="get_parent").
marks a required action parameter; the group schema treats action parameters as optional. Pass action="name" and only that action's parameters. Actions:
activate_window() Activate the current active window. (1C 8.3.3+)
answer_dialog(confirm=True, timeout=5) Wait up to timeout seconds and answer a modal question: confirm=true presses Button0, false Button1. Never presses Button2; inspect the question/window for other choices. Returns answered='Да'/'Нет' and question; both null means no dialog, question alone null means unreadable text. (1C 8.3.3+)
choose_user_message(text*) Click the first user message matching text in the active window; * and ? are wildcards. Use get_user_message_texts to read the available messages first. (1C 8.3.3+)
close_user_messages_panel() Close the window's user-messages panel. This is also how you tell which messages belong to which action: clear the panel, perform the action, then read the messages. (1C 8.3.6+)
close_window(ref=null) Close the window at ref, or the active window if omitted. Returns closed only after verifying that the window disappeared. If it remains open, returns window_not_closed and target; inspect the form or answer its dialog before retrying. Also closes an active local print preview when ref is omitted. (1C 8.3.3+)
execute_command(command*) Open a navigation link, e.g. 'e1cib/list/Справочник.Контрагенты', 'e1cib/app/Обработка.Имя' or a URL returned by the command interface. For a button name or title, find it and use click. Returns the resulting window; window_changed=false reuses the previous window description. An opened error window is a failure. (1C 8.3.3+)
get_command_interface() Get the window's command interface → collection of buttons/groups. (1C 8.3.3+)
get_user_message_texts() Get the user-message texts currently shown in the window → list of strings. They may include earlier actions; the application can also replace the list with identical messages. To judge one action, call tc_window(action="close_user_messages_panel") first, then the action, then this. Messages may appear after the action returns. (1C 8.3.3+)
goto_next_window() Go to the next open window from the active main application window. The client returns an error if navigation is unavailable. (1C 8.3.6+)
goto_previous_window() Go to the previous open window from the active main application window. The client returns an error if navigation is unavailable. (1C 8.3.6+)
goto_start_page() Go to the start page from the active main application window. The client returns an error if navigation is unavailable. (1C 8.3.6+) ref selects the client; otherwise set connection_id when several clients are connected. Use tc_session(action="list_connections"). Success may omit target/connection echoes and shorten window details. Use returned references unchanged in ref; re-find expired elements.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | ||
| text | No | ||
| action | Yes | ||
| command | No | ||
| confirm | No | ||
| timeout | No | ||
| connection_id | No |