Poui
- class tir.main.Poui(config_path='', autostart=True)
- AssertFalse(expected=False, script_message='')
Defines that the test case expects a False response to pass
Usage:
>>> #Instantiating the class >>> inst.oHelper = Webapp() >>> #Calling the method >>> inst.oHelper.AssertFalse()
- AssertTrue(expected=True, script_message='')
Defines that the test case expects a True response to pass
Usage:
>>> #Calling the method >>> inst.oHelper.AssertTrue()
- CheckResult(field=None, user_value=None, po_component='po-input', position=1)
Checks if a field has the value the user expects.
- Parameters:
Usage:
>>> # Calling method to check a value of a field: >>> oHelper.CheckResult("Código", "000001", 'po-input')
- ClickAvatar(position=1)
Click on the POUI Profile Avatar icon. https://po-ui.io/documentation/po-avatar
- Parameters:
position (int) –
Default: 1
Usage:
>>> # Call the method: >>> oHelper.ClickAvatar(position=1) >>> oHelper.ClickAvatar()
- ClickButton(button='', position=1)
Clicks on the Button of POUI component. https://po-ui.io/documentation/po-button
- Parameters:
field – Button to be clicked.
position – Position which element is located. - Default: 1
Usage:
>>> # Call the method: >>> oHelper.ClickButton('Cancelar') :return:
- ClickByLocator(selector='', locator=None, right_click=False)
Note
Necessary import “By” class in the script: from tir.technologies.core.base import By
Note
For more information check this out: https://selenium-python.readthedocs.io/locating-elements.html
Warning
Use only in cases where it is not possible to use a label or name attribute. Any interface change can directly impact the script. Evaluate the possibility of changing the interface before using these methods in the script.
- Parameters:
Usage:
>>> # Call the method: >>> oHelper_Poui.ClickByLocator(selector='.po-page-header-actions > po-button:nth-child(1) > button:nth-child(1)', locator=By.CSS_SELECTOR) :return: None
- ClickCheckBox(label)
ClickChecKBox to check or uncheck box selectors https://po-ui.io/documentation/po-checkbox
- Parameters:
label (str) – The CheckBox label
Usage:
>>> # Calling the method: >>> oHelper.ClickCheckBox("Processing")
- ClickCombo(field='', value='', position=1, second_value='')
Clicks on the Combo of POUI component. https://po-ui.io/documentation/po-combo
- Parameters:
field – Combo text title that you want to click.
value – Value that you want to select in Combo.
position – Position which element is located. - Default: 1
Usage:
>>> # Call the method: >>> oHelper.ClickCombo('Visão', 'Compras') :return:
- ClickIcon(label='', class_name='', position=1)
Click on the POUI Icon by label, class_name or both. https://po-ui.io/guides/icons
- Parameters:
- Returns:
None
Usage:
>>> # 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')
- ClickLink(text='', href='', position=1, contains=False)
Click a PO UI link (po-link) element.
Locate a link element inside PO UI components and perform a click on it. The search can use the visible link text and/or the element’s href attribute. When multiple elements match, the position parameter selects which occurrence to click (1-based).
Parameters :param text: Visible text of the link to click. If empty, text matching is ignored. :type text: str :param href: Destination URL (href attribute) to match. Can be a relative or absolute URL. :type href: str :param position: 1-based index of the occurrence to click when several elements match - Default: 1 :type position: int :param contains: If False (default) the method requires an exact match of text or href;
If True the method accepts a substring match.
Behavior - If only text is provided, matching is performed on the element’s visible text. - If only href is provided, matching is performed solely on the href attribute. - If both text and href are provided, the method filters first by visible text, then by the destination URL (href).
Returns :return: None
Examples >>> # Click by visible text >>> oHelper.ClickLink(‘PO Link’)
>>> # Click by href >>> oHelper.ClickLink(href='https://po-ui.io')
>>> # Click the second link whose visible text contains 'More' >>> oHelper.ClickLink(text='Link', position=2, contains=True)
- ClickLookUp(label='', search_value='')
Component used to open a search window with a table that lists data from a service. https://po-ui.io/documentation/po-lookup
- Parameters:
label – field from lookup input
search_value – Value to input in search field
- Type:
- Type:
- Returns:
Usage: >>> # Call the method: >>> oHelper.ClickLookUp(“Base de Atendimento”, “006TE - PLS_08”) >>> oHelper.ClickLookUp(“Base de Atendimento”)
- ClickMenu(menu_item)
Clicks on the menu-item of the POUI component. https://po-ui.io/documentation/po-menu
:param menu_item:Menu item name :type menu_item: str
Usage:
>>> # Call the method: >>> oHelper.ClickMenu("Contracts")
- ClickPopup(label)
Click on the POUI Profile Avatar icon. https://po-ui.io/documentation/po-popup
- Parameters:
label (str)
Usage:
>>> # Call the method: >>> oHelper.ClickPopup(label="Popup Item") >>> oHelper.ClickPopup()
- ClickSelect(field='', value='', position=1)
Clicks on the Select of POUI component. https://po-ui.io/documentation/po-select
- Parameters:
field – Select text title that you want to click.
value – Value that you want to select in Select.
position – Position which element is located. - Default: 1
Usage:
>>> # Call the method: >>> oHelper.ClickSelect('Espécie', 'Compra') :return:
- ClickSwitch(label='', value=True, position=1)
Click on POUI Switch component https://po-ui.io/documentation/po-switch
- Parameters:
label – field from lookup input
position (int) – Position which duplicated element is located. - Default: 1
- Type:
Usage: >>> # Call the method: >>> oHelper.Switch(label=’Codigo’) >>> oHelper.Switch(label=’Ativo’, position=2) >>> oHelper.Switch(label=’Ver Sld Alt’, value=False)
- ClickTable(first_column=None, second_column=None, first_content=None, second_content=None, table_number=1, itens=False, click_cell=None, checkbox=None, radio_input=None, columns=None, values=None, match_all=False)
Clicks on the Table of POUI component. https://po-ui.io/documentation/po-table and https://thf.dev.totvs.app/v19/documentation/thf-grid
Supports both legacy and new syntax:
Legacy syntax (Deprecated): Use first_column, second_column, first_content, second_content parameters. Will be removed in future versions. >>> oHelper.ClickTable(“Code”, “”, “000001”, “”, click_cell=”Edit”) >>> oHelper.ClickTable(“Code”, “Name”, “000001”, “John”, click_cell=”Edit”)
New syntax (recommended): Use columns and values parameters for cleaner, more flexible filtering. >>> oHelper.ClickTable(columns=’Code’, values=’000001’, click_cell=’Edit’) >>> oHelper.ClickTable(columns=[‘Code’, ‘Name’], values=[‘000001’, ‘John’], click_cell=’Edit’)
- Parameters:
first_column (str) – [DEPRECATED] First column name to filter
second_column (str) – [DEPRECATED] Second column name to filter
first_content (str) – [DEPRECATED] Value to match in first column
second_content (str) – [DEPRECATED] Value to match in second column
table_number (int) – Table position number when multiple table exist - Default: 1
itens (bool) – [DEPRECATED] Click all items matching criteria - Default: False
click_cell – Column name where the click action should occur.
If you need to select rows consider to use checkbox or radio_input parameters - Default: None :type click_cell: str :param checkbox: If True/False, toggles checkbox to that state - Default: None :type checkbox: bool :param radio_input: Click radio button - Default: False :type radio_input: bool :param columns: Column name(s) to filter. Can be a string, or list :type columns: str or list :param values: Value(s) to match in columns. Can be a string, or list :type values: str or list :param match_all: If True, performs action on all matching rows. If False, only first match - Default: False :type match_all: bool
Usage:
>>> # Legacy calls (deprecated): >>> oHelper.ClickTable("Branch", "", "D MG 01", "", click_cell="Edit") >>> oHelper.ClickTable("Code", "Name", "000001", "John") >>> oHelper.ClickTable("Code", "", "000001", "", itens=True)
>>> # New calls (recommended): >>> oHelper.ClickTable(columns='Branch', values='D MG 01', click_cell='Edit') >>> # New syntax - Multiple columns filter: >>> oHelper.ClickTable(columns=['Code', 'Name'], values=['000001', 'John'], click_cell='Actions') >>> # New syntax - Toggle checkbox: >>> oHelper.ClickTable(columns='Code', values='000001', checkbox=True) >>> # New syntax - Click all matching rows: >>> oHelper.ClickTable(columns='Status', values='Active', match_all=True)
Warning
Do not mix legacy and new syntax in the same call. Legacy parameters will be removed in a future release.
Note
When columns is None and values is None, clicks the first row
click_cell specifies which column cell to click (by column name)
checkbox parameter only works with checkbox columns
radio_input parameter only works with radio button columns
Use match_all=True to interact with all rows matching the filter criteria
- Returns:
None
- ClickWidget(title='', action='', position=1)
Clicks on the Widget or Widget action of POUI component. https://po-ui.io/documentation/po-widget
- Parameters:
tittle – Widget text title that you want to click.
action – The name of action to be clicked
position – Position which element is located. - Default: 1
Usage:
>>> # Call the method: >>> oHelper.ClickWidget(title='LEad Time SC x PC', action='Detalhes', position=1) :return:
- GetUrl(url)
Loads a web page in the current browser session. :param url: :type url: str
- IfExists(string='', timeout=5)
Returns True if element exists in timeout or return False if not exist. :param string: String that will hold the wait. :type string: str :param timeout: Timeout that wait before return. :type timeout: str Usage: >>> # Calling the method: >>> exist = oHelper.IfExists(“Aviso”, timeout=10) >>> if oHelper.IfExists(“Aviso”, timeout=10): >>> print(‘Found!’)
- InputByLocator(selector='', locator=None, value='')
Note
Necessary import “By” class in the script: from tir.technologies.core.base import By
Note
For more information check this out: https://selenium-python.readthedocs.io/locating-elements.html
Warning
Use only in cases where it is not possible to use a label or name attribute. Any interface change can directly impact the script. Evaluate the possibility of changing the interface before using these methods in the script.
- Parameters:
Usage:
>>> # 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
- InputValue(field='', value='', position=1)
Fill the POUI input component. https://po-ui.io/documentation/po-input
- Parameters:
Usage:
>>> # Call the method: >>> oHelper.InputValue('Name', 'Test') :return: None
- POSearch(content='', placeholder='')
Fill the POUI Search component. https://po-ui.io/documentation/po-page-dynamic-search
- Parameters:
content (str) – Content to be Search.
Usage:
>>> # Call the method: >>> oHelper.POSearch(content='Content to be Search') :return: None
- POtabs(label='')
Clicks on a Label in po-tab. https://po-ui.io/documentation/po-tabs
- Parameters:
label (str) – The tab label name
>>> # Call the method: >>> oHelper.POTabs(label='Test') :return: None
- TearDown()
Closes the webdriver and ends the test case.
Usage:
>>> #Calling the method >>> inst.oHelper.TearDown()