### StartDB method call to get connection object Source: https://totvs.github.io/tir/webapp.html Calls self.oHelper.StartDB() to start the database connection and returns a connection object. ```python >>> # Call the method: >>> self.oHelper.StartDB() ``` -------------------------------- ### Instantiate Log Source: https://totvs.github.io/tir/log.html Example from base.py showing how to create a Log instance. ```python >>> # Instanted inside base.py: >>> self.log = Log() ``` -------------------------------- ### Start Source: https://totvs.github.io/tir/webapp.html Opens the browser maximized and goes to the defined URL. ```APIDOC ## Start ### Description Opens the browser maximized and goes to the defined URL. ### Method N/A (Python method) ### Parameters None ### Usage Example ```python >>> oHelper.Start() ``` ``` -------------------------------- ### Setup Source: https://totvs.github.io/tir/webapp.html Prepares the Protheus Webapp for the test case by filling environment information. ```APIDOC ## Setup ### Description Prepares the Protheus Webapp for the test case by filling environment information. ### Method N/A (Python method) ### Parameters - **initial_program** (str) - Required - The initial program to load. - **date** (str) - Optional - The date to fill on the environment screen. Default: "" (empty string). - **group** (str) - Optional - The group to fill on the environment screen. Default: "99". - **branch** (str) - Optional - The branch to fill on the environment screen. Default: "01". - **module** (str) - Optional - The module to fill on the environment screen. Default: "" (empty string). ### Usage Example ```python >>> oHelper.Setup("SIGAFAT", "18/08/2018", "T1", "D MG 01 ") ``` ``` -------------------------------- ### StartDB Source: https://totvs.github.io/tir/webapp.html Starts a database connection and returns the connection object. ```APIDOC ## StartDB ### Description Starts a database connection and returns the connection object. ### Method N/A (Python method) ### Returns - **connection** - connection object ### Usage Example ```python >>> self.oHelper.StartDB() ``` ``` -------------------------------- ### Start method usage Source: https://totvs.github.io/tir/base.html Opens the browser maximized and goes to the defined URL. ```python >>> # Calling the method: >>> oHelper.Start() ``` -------------------------------- ### StartSchedule Source: https://totvs.github.io/tir/webapp.html Accesses the Schedule settings and starts all items. ```APIDOC ## StartSchedule ### Description Accesses the Schedule settings and starts all items. ### Method N/A (Python method) ### Parameters None ### Usage Example No usage example provided. ``` -------------------------------- ### SetValue usage examples for input fields and grids Source: https://totvs.github.io/tir/webapp.html Shows various ways to call oHelper.SetValue for input fields, including by label, direction, position, grid, grid_number, check_value, and duplicate_fields. The grid examples require oHelper.LoadGrid() after setting the value. The duplicate_fields example uses self.oHelper.SetValue with a list of duplicate field names and an index. ```python >>> # Calling method to input value on a field: >>> oHelper.SetValue("A1_COD", "000001") >>> #----------------------------------------- >>> # Calling method to input value on a field from a label text and looking an input field for a specific direction: >>> oHelper.SetValue("Codigo", "000001", direction='right') >>> #----------------------------------------- >>> # Calling method to input value on a field using by label name: >>> oHelper.SetValue("Codigo", "000001") >>> #----------------------------------------- >>> # Calling method to input value on a field using by an existing label name: >>> oHelper.SetValue(field = "Codigo", value = "000002", position = 2) >>> #----------------------------------------- >>> # Calling method to input value on a field that is a grid: >>> oHelper.SetValue("Client", "000001", grid=True) >>> oHelper.LoadGrid() >>> #----------------------------------------- >>> # Calling method to checkbox value on a field that is a grid: >>> oHelper.SetValue('Confirmado?', True, grid=True) >>> oHelper.LoadGrid() >>> #----------------------------------------- >>> # Calling method to input value on a field that is on the second grid of the screen: >>> oHelper.SetValue("Order", "000001", grid=True, grid_number=2) >>> oHelper.LoadGrid() >>> #----------------------------------------- >>> # Calling method to input value on a field that is a grid (2) *Will not attempt to verify the entered value. Run only once.* : >>> oHelper.SetValue("Order", "000001", grid=True, grid_number=2, check_value = False) >>> oHelper.LoadGrid() >>> #-------------------------------------- >>> # Calling method to input value in cases that have duplicate fields: >>> oHelper.SetValue('Tipo Entrada' , '073', grid=True, grid_number=2, name_attr=True) >>> self.oHelper.SetValue('Tipo Entrada' , '073', grid=True, grid_number=2, name_attr=True, duplicate_fields=['tipo entrada', 10]) >>> oHelper.LoadGrid() ``` -------------------------------- ### ClickLink usage examples Source: https://totvs.github.io/tir/poui.html Calls oHelper.ClickLink to click PO UI links by visible text, href, or both. The first example clicks by visible text, the second by href, and the third uses contains and position parameters. ```python >>> # Click by visible text >>> oHelper.ClickLink(‘PO Link’) ``` ```python >>> # Click by href >>> oHelper.ClickLink(href='https://po-ui.io') ``` ```python >>> # Click the second link whose visible text contains 'More' >>> oHelper.ClickLink(text='Link', position=2, contains=True) ``` -------------------------------- ### POtabs usage example Source: https://totvs.github.io/tir/poui.html Clicks on a label in the po-tab component. ```python >>> # Call the method: >>> oHelper.POTabs(label='Test') :return: None ``` -------------------------------- ### ClickIcon usage examples Source: https://totvs.github.io/tir/poui.html Calls oHelper.ClickIcon with label, class_name, or both to click a POUI icon. Three examples show different ways to specify the icon. ```python >>> # Call the method: >>> oHelper.ClickIcon(label='Delete') >>> oHelper.ClickIcon(class_name='po-icon po-icon-delete') >>> oHelper.ClickIcon(label='Delete', class_name='po-icon po-icon-delete') ``` -------------------------------- ### CheckResult usage examples Source: https://totvs.github.io/tir/webapp.html Shows how to call CheckResult to verify field values, including grid fields, multiple grids, and non-input fields. The examples demonstrate optional parameters like grid, line, grid_number, input_field, and direction. ```python >>> # Calling method to check a value of a field: >>> oHelper.CheckResult("A1_COD", "000001") >>> #----------------------------------------- >>> # Calling method to check a field that is on the second line of a grid: >>> oHelper.CheckResult("Client", "000001", grid=True, line=2) >>> oHelper.LoadGrid() >>> #----------------------------------------- >>> # Calling method to check a field that is on the second grid of the screen: >>> oHelper.CheckResult("Order", "000001", grid=True, line=1, grid_number=2) >>> oHelper.LoadGrid() >>> #----------------------------------------- >>> # Call method to check a field value that is not an input field and is on the right: >>> oHelper.CheckResult("Saldo Titulo", "100.000,00", input_field=False, direction='right') >>> oHelper.LoadGrid() ``` -------------------------------- ### Setup method call with parameters Source: https://totvs.github.io/tir/webapp.html Calls oHelper.Setup with the initial program, date, group, branch, and module parameters to prepare the Protheus Webapp for a test case. Defaults are date='', group='99', branch='01', module=''. ```python >>> # Calling the method: >>> oHelper.Setup("SIGAFAT", "18/08/2018", "T1", "D MG 01 ") ``` -------------------------------- ### POSearch usage example Source: https://totvs.github.io/tir/poui.html Fills the POUI Search component with the specified content. ```python >>> # Call the method: >>> oHelper.POSearch(content='Content to be Search') :return: None ``` -------------------------------- ### ClickDropdown usage examples Source: https://totvs.github.io/tir/poui.html Calls oHelper.ClickDropdown with label and optional subitems. The first example selects subitem 'Edit' from dropdown labeled 'Actions'; the second opens a dropdown labeled 'Ações de registro' without selecting a subitem. ```python >>> # Call the method: >>> oHelper.ClickDropdown(label='Actions', subitems='Edit') >>> oHelper.ClickDropdown(label='Ações de registro') ``` -------------------------------- ### Program usage example Source: https://totvs.github.io/tir/poui.html Sets the program in the initial menu search field. Only used when the Initial Program is the module (e.g., SIGAFAT). If the module dialog appears and no module is provided, the first available module is selected. ```python >>> # Calling the method: >>> oHelper.Program("MATA020") >>> oHelper.Program("CRDA200", module="CRD") ``` -------------------------------- ### SetProcedures usage Source: https://totvs.github.io/tir/webapp.html Add a procedure with AddProcedure and then call SetProcedures with is_procedure_install=True to install it in the CFG screen. ```python >>> # Adding procedures: >>> oHelper.AddProcedure("19", "T1") >>> # Calling the method: >>> oHelper.SetProcedures(is_procedure_install=True) ``` -------------------------------- ### OpenCSV config.json example Source: https://totvs.github.io/tir/webapp.html Shows the CSVPath configuration in config.json, required for the OpenCSV method. The folder must be entered in this parameter. ```json >>> config.json >>> '"CSVPath": "C:\temp"' ``` -------------------------------- ### ClickTable - New syntax examples Source: https://totvs.github.io/tir/poui.html New syntax for ClickTable, recommended. Uses columns and values parameters for cleaner, more flexible filtering. ```python >>> oHelper.ClickTable(columns='Code', values='000001', click_cell='Edit') >>> oHelper.ClickTable(columns=['Code', 'Name'], values=['000001', 'John'], click_cell='Edit') ``` -------------------------------- ### RestRegistry Source: https://totvs.github.io/tir/webapp.html Restores registry keys in appserver.ini to start point. ```APIDOC ## RestRegistry ### Description Restores registry keys in appserver.ini to start point. ### Method RestRegistry ### Usage ``` >>> self.oHelper.RestRegistry() ``` ``` -------------------------------- ### CheckView usage example Source: https://totvs.github.io/tir/webapp.html Shows how to call CheckView to verify that a text is present on the screen. The default element_type is 'help', which closes the element. ```python >>> # Calling the method. >>> oHelper.CheckView("Processing") ``` -------------------------------- ### ClickBox usage examples Source: https://totvs.github.io/tir/webapp.html Shows how to call ClickBox to select checkboxes in a grid, including selecting specific, multiple, all, and based on multiple fields or item references. ```python >>> # Calling the method to select a specific checkbox: >>> oHelper.ClickBox("Branch", "D MG 01 ") >>> #-------------------------------------------------- >>> # Calling the method to select multiple checkboxes: >>> oHelper.ClickBox("Branch", "D MG 01 , D RJ 02") >>> #-------------------------------------------------- >>> # Calling the method to select all checkboxes: >>> oHelper.ClickBox("Branch", select_all=True) >>> #-------------------------------------------------- >>> # Calling the method to performe click based in 2 fields and contens: >>> test_helper.ClickBox('Numero da SC, Item da SC', 'COM068, 0001') >>> #-------------------------------------------------- >>> # Calling the method to click in all itens with this reference: >>> test_helper.ClickBox('Numero da SC', 'COM068', itens=True) ``` -------------------------------- ### GetRouteMock() Source: https://totvs.github.io/tir/webapp.html Gets the server mock route set in config.json file. ```APIDOC ## GetRouteMock() ### Description Gets the server mock route set in config.json file. ### Method Function call ### Endpoint `oHelper.GetRouteMock()` ### Parameters None ### Request Example No example provided. ### Response No return value documented. ``` -------------------------------- ### OpenCSV header with column example Source: https://totvs.github.io/tir/webapp.html Opens a CSV file with a header and returns only the column named 'CAMPO'. ```python >>> file_csv_column = self.oHelper.OpenCSV(column='CAMPO', delimiter=";", csv_file="header_column.csv", header=True) ``` -------------------------------- ### SetFilePath usage examples Source: https://totvs.github.io/tir/webapp.html Fills the path screen with the desired path. The button name must be informed or the program will select the current button name. The first call uses the default button; the second passes the button name "save". ```python >>> # Calling the method: >>> oHelper.SetFilePath(r"C:\folder") >>> oHelper.SetFilePath(r"C:\folder","save") ``` -------------------------------- ### WaitShow usage example Source: https://totvs.github.io/tir/poui.html Waits for the specified string to be shown. The 'itens' parameter is the string that will hold the wait. ```python >>> # Calling the method: >>> oHelper.WaitShow("Processing") ``` -------------------------------- ### OpenCSV header example Source: https://totvs.github.io/tir/webapp.html Opens a CSV file with a header using the OpenCSV method. Returns a dictionary when the file has a header. ```python >>> file_csv_header = self.oHelper.OpenCSV(delimiter=";", csv_file="header.csv", header=True) ``` -------------------------------- ### SetButton usage examples Source: https://totvs.github.io/tir/webapp.html Shows how to call SetButton for a regular button, a sub item, and a nested sub item. For nested sub items, separate each menu and item with a comma and a space, e.g. "Delete, Residue". If a sequence of similar buttons is used, insert a wait method like WaitShow or WaitHide between them to ensure the correct element is selected. ```python >>> # Calling the method to click on a regular button: >>> oHelper.SetButton("Add") >>> #------------------------------------------------- >>> # Calling the method to click on a sub item inside a button. >>> oHelper.SetButton("Other Actions", "Process") >>> #------------------------------------------------- >>> # Calling the method to click on a sub item in a sub item that is inside a button. >>> oHelper.SetButton("Other Actions", "Delete, Delete") ``` -------------------------------- ### OpenCSV pipe delimiter example Source: https://totvs.github.io/tir/webapp.html Opens a CSV file without a header using the pipe delimiter. ```python >>> file_csv_pipe = self.oHelper.OpenCSV(delimiter="|", csv_file="pipe_no_header.csv") ``` -------------------------------- ### SetKey usage examples Source: https://totvs.github.io/tir/webapp.html Presses the desired key on the focused element. Supported keys include F1 to F12, CTRL+Key, ALT+Key, Up, Down, Left, Right, ESC, Enter, and Delete. If this method is the first to be called, use a wait method like WaitShow; also set focus on an element before using it. ```python >>> # Calling the method: >>> oHelper.SetKey("ENTER") >>> #-------------------------------------- >>> # Calling the method on a grid: >>> oHelper.SetKey("DOWN", grid=True) >>> #-------------------------------------- >>> # Calling the method on the second grid on the screen: >>> oHelper.SetKey("DOWN", grid=True, grid_number=2) >>> #-------------------------------------- >>> # Calling the method when you expected new window or text appears on the screen: >>> oHelper.SetKey( key = "F12", wait_show="Parametros", step = 3 ) >>> #-------------------------------------- >>> # Calling the method with special keys (using parameter additional_key): >>> oHelper.SetKey(key="CTRL", additional_key="A") ``` -------------------------------- ### ClickTable: Legacy and New Syntax Usage Source: https://totvs.github.io/tir/poui_internal.html Shows both legacy and new syntax for ClickTable. Legacy uses positional arguments (first_column, second_column, first_content, second_content) while new uses keyword arguments (columns, values). Includes examples for clicking a cell, matching all rows, checkbox, radio input, and clicking an icon. ```python >>> oHelper.ClickTable(columns='Code', values='000001', click_cell='Edit') >>> oHelper.ClickTable(columns=['Code', 'Name'], values=['000001', 'John'], click_cell='Edit') ``` ```python >>> # Legacy calls (still supported): >>> oHelper.ClickTable("Branch", "", "D MG 01", "", click_cell="Edit") >>> oHelper.ClickTable("Code", "Name", "000001", "John") >>> oHelper.ClickTable("Code", "", "000001", "", itens=True) ``` ```python >>> # New calls (recommended): >>> oHelper.ClickTable(columns='Branch', values='D MG 01', click_cell='Edit') >>> oHelper.ClickTable(columns=['Code', 'Name'], values=['000001', 'John']) >>> oHelper.ClickTable(columns='Status', values=True, match_all=True, checkbox=True) >>> self.oHelper_Poui.ClickTable(columns='Filial', values='D MG 01', radio_input=True) >>> self.oHelper_Poui.ClickTable(columns='Filial', values='D MG 01', radio_input=False) >>> # Click icon in row: >>> oHelper.ClickTable(columns='Code', values='000001', icon_class='arrow-up-right') >>> oHelper.ClickTable(columns='Code', values='000001', icon_class='ph-arrow-up-right') ``` -------------------------------- ### OpenCSV no header example Source: https://totvs.github.io/tir/webapp.html Opens a CSV file without a header using the OpenCSV method. Returns a list when the file has no header. ```python >>> # Call the method: >>> file_csv = self.oHelper.OpenCSV(delimiter=";", csv_file="no_header.csv") ``` -------------------------------- ### WaitProcessing usage example Source: https://totvs.github.io/tir/poui.html Uses WaitShow and WaitHide to wait for a processing screen. The 'itens' parameter is a list of items that will hold the wait. ```python >>> # Calling the method: >>> oHelper.WaitProcessing("Processing") ``` -------------------------------- ### ClickWidget Usage Source: https://totvs.github.io/tir/poui_internal.html Calls ClickWidget with title, action, and position parameters. The example uses title='LEad Time SC x PC', action='Detalhes', and position=1. ```python >>> # Call the method: >>> oHelper.ClickWidget(title='LEad Time SC x PC', action='Detalhes', position=1) :return: ``` -------------------------------- ### ClickTable - Legacy syntax examples Source: https://totvs.github.io/tir/poui.html Legacy syntax for ClickTable, deprecated. Uses first_column, second_column, first_content, second_content parameters. Will be removed in future versions. ```python >>> oHelper.ClickTable("Code", "", "000001", "", click_cell="Edit") >>> oHelper.ClickTable("Code", "Name", "000001", "John", click_cell="Edit") ``` -------------------------------- ### ClickRadio - Select, deselect, and position examples Source: https://totvs.github.io/tir/poui.html Clicks on a POUI radio button until it reaches the desired state. The active parameter defaults to True, and position defaults to 1. The method locates the radio by its visible label. ```python >>> # Select a radio button by label: >>> oHelper.ClickRadio("Ativo") >>> #----------------------------------------- >>> # Deselect a radio button: >>> oHelper.ClickRadio("Ativo", active=False) >>> #----------------------------------------- >>> # Select the second radio button with the same label: >>> oHelper.ClickRadio("Tipo", position=2) ``` -------------------------------- ### InputValue usage example Source: https://totvs.github.io/tir/poui.html Fills a POUI input component. When a boolean is passed, it delegates to ClickRadio() to select or deselect a radio button. ```python >>> # Call the method: >>> oHelper.InputValue('Name', 'Test') >>> # Select a radio button (delegates to click_radio): >>> oHelper.InputValue('Status', True) >>> # Deselect a radio button: >>> oHelper.InputValue('Status', False) :return: None ``` -------------------------------- ### get_current_DOM usage Source: https://totvs.github.io/tir/base.html Usage example for the get_current_DOM method. Calls the method to get the current DOM as a BeautifulSoup object. ```python >>> #Calling the method >>> soup = self.get_current_DOM() ``` -------------------------------- ### InputByLocator usage example Source: https://totvs.github.io/tir/poui.html Calls InputByLocator with a CSS selector to interact with a PO Select component. Requires importing the By class from tir.technologies.core.base. Use only when label or name attributes are not available. ```python >>> # Call the method: >>> oHelper_Poui.InputByLocator(selector='[p-label="PO Select"] [class="po-field-container-content"] > select', locator=By.CSS_SELECTOR, value='Option 2') :return: None ``` -------------------------------- ### filter_displayed_elements usage Source: https://totvs.github.io/tir/base.html Usage example for the filter_displayed_elements method. Gets the current DOM, selects div elements, and filters displayed ones with reverse=True. ```python >>> #Defining the element list: >>> soup = self.get_current_DOM() >>> elements = soup.select("div") >>> #Calling the method >>> self.filter_displayed_elements(elements, True) ``` -------------------------------- ### SetupTSS method call with initial program and environment Source: https://totvs.github.io/tir/webapp.html Calls oHelper.SetupTSS with the initial program and environment to prepare the Protheus Webapp TSS. Uses the user and password from config.json. ```python >>> # Calling the method: >>> oHelper.SetupTSS("TSSMANAGER", "SPED") ``` -------------------------------- ### Get ini value with oHelper.GetIniValue Source: https://totvs.github.io/tir/webapp.html Get a value from an ini file. The ini_path parameter defaults to the appserver folder defined in config.json. ```python >>> # Calling the method: >>> value = oHelper.GetIniValue(key="sourcepath", section="PROTHEUS_ENVIRONMENT") >>> #-------------------------------------------------- >>> # Calling the method with custom ini path: >>> value = oHelper.GetIniValue(key="dbport", ini_path="C:\TOTVS\Protheus12\appserver") ``` -------------------------------- ### Get release and conditionally set value Source: https://totvs.github.io/tir/webapp.html Get the current Protheus release and use it in a conditional to set a value only when the release is greater than or equal to '12.1.027'. ```python >>> # Calling the method: >>> oHelper.GetRelease() >>> # Conditional with method: >>> # Situation: Have a input that only appears in release greater than or equal to 12.1.027 >>> if self.oHelper.GetRelease() >= '12.1.027': >>> self.oHelper.SetValue('AK1_CODIGO', 'codigo_CT001') ``` -------------------------------- ### Get grid object with get_grid Source: https://totvs.github.io/tir/webapp.html Get a grid BeautifulSoup object from the screen. The grid_element parameter accepts a CSS class selector, e.g., '.tgrid'. ```python >>> # Calling the method: >>> my_grid = self.get_grid() >>> my_grid = self.get_grid(grid_element='.dict-msbrgetdbase') ``` -------------------------------- ### SetupTSS Source: https://totvs.github.io/tir/webapp.html Prepares the Protheus Webapp TSS for the test case, using user and password from config.json. ```APIDOC ## SetupTSS ### Description Prepares the Protheus Webapp TSS for the test case, using user and password from config.json. ### Method N/A (Python method) ### Parameters - **initial_program** (str) - Optional - The initial program to load. - **environment** (str) - Optional - The initial environment to load. ### Usage Example ```python >>> oHelper.SetupTSS("TSSMANAGER", "SPED") ``` ``` -------------------------------- ### Get field value with oHelper.GetValue Source: https://totvs.github.io/tir/webapp.html Get the current value or text of a field. For a colored status column, set the field as an empty string and use grid=True with position. ```python >>> # Calling the method: >>> current_value = oHelper.GetValue("A1_COD") ``` -------------------------------- ### Program() - Set program in initial menu search field Source: https://totvs.github.io/tir/poui_internal.html Sets the program in the initial menu search field on New Home. Supports program name, description, module, and save_input flags. ```python >>> # Calling the method: >>> self.Program("MATA020") >>> self.Program("CRDA200", module="CRD") >>> self.Program(program_desc="About", save_input=False) ``` -------------------------------- ### Program method usage Source: https://totvs.github.io/tir/webapp.html Sets the program in the initial menu search field. The module parameter is optional and only applies to New Home (POUI); if not provided, the first available module is selected when the dialog appears. ```python >>> # Calling the method: >>> oHelper.Program("MATA020") >>> oHelper.Program("FINA410", module="Controle de Lojas") ``` -------------------------------- ### GetRelease() Source: https://totvs.github.io/tir/webapp.html Gets the current release from Protheus. ```APIDOC ## GetRelease() ### Description Gets the current release from Protheus. ### Method Function call ### Endpoint `oHelper.GetRelease()` ### Parameters None ### Request Example ```python >>> # Calling the method: >>> oHelper.GetRelease() >>> # Conditional with method: >>> # Situation: Have a input that only appears in release greater than or equal to 12.1.027 >>> if self.oHelper.GetRelease() >= '12.1.027': >>> self.oHelper.SetValue('AK1_CODIGO', 'codigo_CT001') ``` ### Response Returns the current release from Protheus (str). ``` -------------------------------- ### Program Source: https://totvs.github.io/tir/poui.html Sets the program in the initial menu search field, optionally selecting a module. ```APIDOC ## Program ### Description Sets the program in the initial menu search field. Used when the initial program is a module (e.g., SIGAFAT). ### Method N/A (Python method) ### Endpoint N/A ### Parameters - **program_name** (str) - Required - The program name. - **module** (str) - Optional - Module name that will be selected in the "Change module" dialog after choosing the routine. If not provided and the dialog appears, the first available module will be selected. Default: "" (empty string). ### Request Example ```python >>> oHelper.Program("MATA020") >>> oHelper.Program("CRDA200", module="CRD") ``` ### Response #### Success Response - Returns None. #### Response Example ```python None ``` ``` -------------------------------- ### get_soup_select Source: https://totvs.github.io/tir/base.html Get a soup select object. ```APIDOC ## get_soup_select ### Description Get a soup select object. ### Method GET ### Endpoint `get_soup_select(selector, twebview=None, select_one=False)` ### Parameters - **selector** (str) - Required - CSS selector. - **twebview** (bool) - Optional - Force twebview mode. If None, keeps legacy behavior. - **select_one** (bool) - Optional - When True, returns only the first match. ### Returns - **soup select object** - The soup select object. ``` -------------------------------- ### ProgramScreen method usage Source: https://totvs.github.io/tir/webapp.html Fills the first screen of Protheus with the initial program to run. ```python >>> # Calling the method: >>> self.oHelper.ProgramScreen("SIGAADV") ``` -------------------------------- ### GetValue Source: https://totvs.github.io/tir/poui_internal.html Gets the current value or text of element. ```APIDOC ## GetValue ### Description Gets the current value or text of element. ### Method GetValue ### Parameters - **field** (str) - Required - The field or label of a field that must be checked. - **grid** (bool) - Optional - Boolean if this is a grid field or not. Default: False - **line** (int) - Optional - Grid line that contains the column field to be checked. Default: 1 - **grid_number** (int) - Optional - Grid number of which grid should be checked when there are multiple grids on the same screen. Default: 1 - **grid_memo_field** (bool) - Optional - Boolean if this is a memo grid field. Default: False ### Usage Example ```python >>> current_value = oHelper.GetValue("A1_COD") ``` ### Returns Current value or text of element. ``` -------------------------------- ### Program Source: https://totvs.github.io/tir/webapp.html Sets the program in the initial menu search field. Only used when the Initial Program is the module Ex: SIGAFAT. ```APIDOC ## Program ### Description Sets the program in the initial menu search field. Only used when the Initial Program is the module Ex: SIGAFAT. ### Method Program ### Parameters - **program_name** (str) - Required - The program name. - **module** (str) - Optional - Module name that will be selected in the "Change module" dialog after choosing the routine. If not provided and the dialog appears, the first available module will be selected. Only applies to New Home (POUI). Default: "" (empty string). ### Usage ``` >>> # Calling the method: >>> oHelper.Program("MATA020") >>> oHelper.Program("FINA410", module="Controle de Lojas") ``` ``` -------------------------------- ### PouiInternal constructor usage Source: https://totvs.github.io/tir/poui_internal.html Shows how to instantiate PouiInternal inside the __init__ method of a Webapp class in main.py, passing config_path and autostart parameters. ```python >>> # Inside __init__ method in Webapp class of main.py >>> def __init__(self, config_path="", autostart=True): >>> self.__webapp = PouiInternal(config_path, autostart) ``` -------------------------------- ### Get text from modal with oHelper.GetText Source: https://totvs.github.io/tir/webapp.html Get a string from a modal based on left or right position parameters. If string_left is filled, the right side content is returned; if string_right is filled, the left side content is returned; if no parameter is filled, the full content is returned. ```python >>> # Calling the method: >>> oHelper.GetText(string_left="Left Text", string_right="Right Text") >>> oHelper.GetText(string_left="Left Text") >>> oHelper.GetText() ``` -------------------------------- ### GetGrid(grid_number=1, grid_element=None) Source: https://totvs.github.io/tir/webapp.html Gets a grid BeautifulSoup object from the screen. ```APIDOC ## GetGrid(grid_number=1, grid_element=None) ### Description Gets a grid BeautifulSoup object from the screen. ### Method Function call ### Endpoint `oHelper.GetGrid(grid_number=1, grid_element=None)` ### Parameters - **grid_number** (_int_) - Optional - The number of the grid on the screen. Default: 1 - **grid_element** (_str_) - Optional - Grid class name in HTML ex: ".tgrid". Default: If None return all webapp classes. ### Request Example ```python >>> # Calling the method: >>> my_grid = self.get_grid() >>> my_grid = self.get_grid(grid_element='.dict-msbrgetdbase') ``` ### Response Returns a Grid BeautifulSoup object. ``` -------------------------------- ### ProgramScreen Source: https://totvs.github.io/tir/webapp.html Fills the first screen of Protheus with the first program to run. ```APIDOC ## ProgramScreen ### Description Fills the first screen of Protheus with the first program to run. ### Method ProgramScreen ### Parameters - **initial_program** (str) - Optional - The initial program to load. ### Usage ``` >>> # Calling the method: >>> self.oHelper.ProgramScreen("SIGAADV") ``` ``` -------------------------------- ### GetIniValue(key, section='', ini_path='') Source: https://totvs.github.io/tir/webapp.html Gets a value from an ini file. ```APIDOC ## GetIniValue(key, section='', ini_path='') ### Description Gets a value from an ini file. ### Method Function call ### Endpoint `oHelper.GetIniValue(key, section='', ini_path='')` ### Parameters - **section** (_str_) - Optional - The section of the ini file. - **key** (_str_) - Required - The key of the ini file. - **ini_path** (_str_) - Optional - The path to the appserver ini file. Default: appserver folder defined in config.json ### Request Example ```python >>> # Calling the method: >>> value = oHelper.GetIniValue(key="sourcepath", section="PROTHEUS_ENVIRONMENT") >>> #-------------------------------------------------- >>> # Calling the method with custom ini path: >>> value = oHelper.GetIniValue(key="dbport", ini_path="C:\TOTVS\Protheus12\appserver") ``` ### Response Returns the value of the key in the ini file (str). ``` -------------------------------- ### GetConfigValue(json_key) Source: https://totvs.github.io/tir/webapp.html Gets a value from the config.json file based on the provided JSON key. ```APIDOC ## GetConfigValue(json_key) ### Description Gets a value from the config.json file based on the provided JSON key. ### Method Function call ### Endpoint `oHelper.GetConfigValue(json_key)` ### Parameters - **json_key** (_str_) - Required - Json Key in config.json ### Request Example No example provided. ### Response Returns the Json Key item in config.json. ``` -------------------------------- ### RemoveBrowseFilters usage example Source: https://totvs.github.io/tir/poui.html Removes all active filters from the THF Browse (kendo-grid) component. ```python >>> # Call the method: >>> oHelper.RemoveBrowseFilters() ``` -------------------------------- ### GetValue Usage Source: https://totvs.github.io/tir/poui_internal.html Calls GetValue to retrieve the current value of a field. The example uses field='A1_COD'. ```python >>> # Calling the method: >>> current_value = oHelper.GetValue("A1_COD") ``` -------------------------------- ### LoadGrid Source: https://totvs.github.io/tir/webapp.html Runs all actions of the input and check queues of a grid. ```APIDOC ## LoadGrid ### Description Runs all actions of the input and check queues of a grid. After running, the queues will be empty. Must be called after SetValue and CheckResult calls that have the grid parameter set to True. ### Method LoadGrid ### Usage Example ```python >>> # After SetValue: >>> oHelper.SetValue("A1_COD", "000001", grid=True) >>> oHelper.LoadGrid() >>> #-------------------------------------- >>> # After CheckResult: >>> oHelper.CheckResult("A1_COD", "000001", grid=True, line=1) >>> oHelper.LoadGrid() ``` ``` -------------------------------- ### config.json base structure Source: https://totvs.github.io/tir/configjson.html Base structure for the config.json file, showing the required parameters and placeholders for additional keys. The file must be placed in the workspace or its path passed as a parameter to class initialization. ```json { "Url": "http://localhost:8080/", "Browser": "Firefox", "Environment": "MyProtheusEnvironment", "User": "MyUser", "Password": "MyP4ssW0rd123" "...", "..." } ``` -------------------------------- ### AddProcedure usage Source: https://totvs.github.io/tir/webapp.html Installs or uninstalls a procedure in CFG to be set by SetProcedures. The procedure and group are specified. ```python >>> # Calling the method: >>> oHelper.AddProcedure("01", "T1") ``` -------------------------------- ### GetValue(field, grid=False, line=1, grid_number=1, grid_memo_field=False, position=0) Source: https://totvs.github.io/tir/webapp.html Gets the current value or text of an element. ```APIDOC ## GetValue(field, grid=False, line=1, grid_number=1, grid_memo_field=False, position=0) ### Description Gets the current value or text of an element. ### Method Function call ### Endpoint `oHelper.GetValue(field, grid=False, line=1, grid_number=1, grid_memo_field=False, position=0)` ### Parameters - **field** (_str_) - Required - The field or label of a field that must be checked. If the column is a colored status, you must set the field as "" , ex: GetValue("", grid=True, position= 1) - **grid** (_bool_) - Optional - Boolean if this is a grid field or not. Default: False - **line** (_int_) - Optional - Grid line that contains the column field to be checked. Default: 1 - **grid_number** (_int_) - Optional - Grid number of which grid should be checked when there are multiple grids on the same screen. Default: 1 - **grid_memo_field** (_bool_) - Optional - Boolean if this is a memo grid field. Default: False - **position** (_int_) - Optional - Position which duplicated element is located. Default: 1 ### Request Example ```python >>> # Calling the method: >>> current_value = oHelper.GetValue("A1_COD") ``` ### Response Returns the current value or text of the element. ``` -------------------------------- ### ChangeUser Source: https://totvs.github.io/tir/poui_internal.html Change the user then init protheus on home page. ```APIDOC ## ChangeUser ### Description Change the user then init protheus on home page. ### Method ChangeUser ### Parameters - **user** (str) - Required - The user to change to. - **password** (str) - Required - The password for the user. - **initial_program** (str) - Optional - The initial program to load. Default: "" (previous initial_program) - **date** (str) - Optional - The date to fill on the environment screen. Default: "" (previous date) - **group** (str) - Optional - The group to fill on the environment screen. Default: "previous date group" - **branch** (str) - Optional - The branch to fill on the environment screen. Default: "previous branch" ### Usage ``` >>> # Calling the method: >>> oHelper.ChangeUser("userTest", "a", "SIGAFAT", "18/08/2018", "T1", "D MG 01 ") >>> #------------------------------------------------------------------------ >>> # Calling the method: >>> oHelper.ChangeUser(user="user08", password="8" ) >>> #------------------------------------------------------------------------ ``` ``` -------------------------------- ### SetLateralMenu(_menu_itens: str, _program_name: str = '', _module: str = '', _save_input: bool = True_) → None Source: https://totvs.github.io/tir/poui_internal.html Navigate through New Home menu context and open a routine. ```APIDOC ## SetLateralMenu(_menu_itens: str, _program_name: str = '', _module: str = '', _save_input: bool = True_) → None ### Description Navigate through New Home menu context and open a routine. ### Parameters - **menu_itens** (_str_) – Menu path used as fallback to derive the routine description. - **program_name** (_str_) – Program code to execute when provided. - **Default:** “” (empty string) - **module** (_str_) – Module abbreviation used to differentiate routines with the same name. - **Default:** “” (empty string) - **save_input** (_bool_) – Forwarded to Program() to control if the navigation should persist routine metadata in config/log. Use **False** for temporary/internal menu navigation. - **Default:** True ``` -------------------------------- ### find_label_element usage Source: https://totvs.github.io/tir/base.html Usage example for the find_label_element method. Calls the method with a label text and a container object. ```python >>> self.find_label_element("User:", container_object) ```