### LoginHelper - Authenticate Perspective Sessions Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt LoginHelper provides utilities for logging users into Perspective sessions. It supports logging in through the standard login page, continuing from an interstitial page, logging in via an active session using the App Bar, and handling exit login scenarios. ```python from selenium.webdriver import Chrome from Helpers.PerspectivePages.LoginHelper import LoginHelper driver = Chrome() login_helper = LoginHelper(driver=driver) # Check if on login page if login_helper.on_login_page(): # Log in through the Perspective Login page login_helper.log_in_through_login_page( username="admin", password="password" ) # Check if on interstitial continue page if login_helper.on_interstitial_continue_to_login_page(): login_helper.continue_to_log_in() # Log in through active session (uses App Bar) login_helper.log_in_through_active_session( username="operator", password="password" ) # Wait for login page to appear login_helper.wait_for_login_page(time_to_wait=10) # Exit login (for projects that don't require auth) login_helper.click_exit_login() ``` -------------------------------- ### BasicComponent - Core Component Wrapper for Selenium Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt The BasicComponent class is the foundation for UI element interactions in the framework. It enhances Selenium WebElements with features like automatic waiting, retry mechanisms for stale elements, and support for CSS/XPath locators. It also includes methods for common interactions and property retrieval, along with specific handling for Perspective components and quality overlays. ```python from selenium.webdriver.common.by import By from selenium.webdriver import Chrome from Components.BasicComponent import BasicComponent, BasicPerspectiveComponent # Initialize WebDriver driver = Chrome() driver.get("http://localhost:8088/data/perspective/client/MyProject") # Create a basic component using CSS selector submit_button = BasicComponent( locator=(By.CSS_SELECTOR, "button.submit-btn"), driver=driver, timeout=10, description="Submit form button" ) # Find and interact with the component submit_button.click() submit_button.double_click() submit_button.hover() # Get component properties text = submit_button.get_text() width = submit_button.get_computed_width(include_units=False) height = submit_button.get_computed_height(include_units=True) # Returns "50px" origin = submit_button.get_origin() # Returns Point(x, y) # Check display state is_visible = submit_button.is_displayed() # Wait for element to disappear submit_button.lose(timeout=5) # For Perspective-specific components with quality overlay support perspective_component = BasicPerspectiveComponent( locator=(By.CSS_SELECTOR, "div.my-component"), driver=driver, timeout=10, raise_exception_for_overlay=True # Raises exception if quality overlay present ) # Check for quality overlays has_overlay = perspective_component.quality_overlay_is_displayed() perspective_component.wait_for_no_overlay(timeout=10) ``` -------------------------------- ### BasicPageObject - Foundation for Page Objects Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt BasicPageObject serves as the base class for all page objects, offering fundamental navigation and state-checking capabilities. It requires a driver instance, URL, timeout, and a primary locator for identifying the page element. ```python from selenium.webdriver.common.by import By from selenium.webdriver import Chrome from Pages.BasicPageObject import BasicPageObject driver = Chrome() # Create a page object class LoginPage(BasicPageObject): def __init__(self, driver): super().__init__( driver=driver, url="http://localhost:8088/login", timeout=10, primary_locator=(By.CSS_SELECTOR, "form.login-form") ) login_page = LoginPage(driver) # Navigate to the page login_page.navigate_to() # Force navigation even if already on page login_page.navigate_to(force=True) # Check if this is the current page is_current = login_page.is_current_page() # Get configured URL url = login_page.get_page_url() ``` -------------------------------- ### Create Reusable Navigation Menu Page Piece (Python) Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt Defines a Python class 'NavigationMenu' that inherits from 'PagePiece' to encapsulate interactions with a navigation menu. It includes methods to initialize the menu and click specific menu items based on their names. This promotes code reusability and maintainability in automated testing. ```python from selenium.webdriver.common.by import By # Assuming PagePiece and driver are defined elsewhere # class PagePiece: # def __init__(self, driver, timeout, primary_locator): # self.driver = driver # self.timeout = timeout # self.primary_locator = primary_locator # # def is_present(self): # # Placeholder for presence check logic # return True class NavigationMenu(PagePiece): def __init__(self, driver): super().__init__( driver=driver, timeout=10, primary_locator=(By.CSS_SELECTOR, "nav.main-menu") ) def click_menu_item(self, item_name): locator = (By.CSS_SELECTOR, f"a[data-menu-item='{item_name}']") self.driver.find_element(*locator).click() # Example Usage: # Assuming 'driver' is an initialized WebDriver instance # nav_menu = NavigationMenu(driver) # # if nav_menu.is_present(): # nav_menu.click_menu_item("Dashboard") ``` -------------------------------- ### IgnitionPageObject - Ignition Gateway Page Wrapper Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt IgnitionPageObject extends BasicPageObject to handle Ignition-specific pages, including gateway address management. It simplifies navigation to pages within an Ignition gateway by abstracting the gateway URL and destination path. ```python from selenium.webdriver.common.by import By from selenium.webdriver import Chrome from Pages.IgnitionPageObject import IgnitionPageObject driver = Chrome() # Create an Ignition page object class StatusPage(IgnitionPageObject): def __init__(self, driver, gateway_address): super().__init__( driver=driver, gateway_address=gateway_address, destination_path="/StatusPage", timeout=10, primary_locator=(By.CSS_SELECTOR, "div.status-container") ) # Usage with gateway address gateway = "http://localhost:8088" status_page = StatusPage(driver, gateway_address=gateway) status_page.navigate_to() ``` -------------------------------- ### IASelenium: Enhanced Selenium Operations for Perspective (Python) Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt IASelenium offers specialized Selenium interaction methods for Perspective applications. It includes functionalities for mouse operations, drag and drop, multi-select, scrolling, tab management, viewport manipulation, screenshots, browser navigation, and element highlighting. ```python from selenium.webdriver import Chrome from Helpers.IASelenium import IASelenium from Helpers.CSSEnumerations import CSS driver = Chrome() selenium = IASelenium(driver=driver) # Mouse operations selenium.hover_over_web_element(web_element=some_element) selenium.click_at_offset(x=100, y=50) selenium.double_click(web_element=some_element) selenium.right_click(web_element=some_element) selenium.long_click(web_element=some_element) # Click and hold for 2 seconds # Drag and drop selenium.click_drag_release(web_element=draggable, x=200, y=0) # Click with offset from element center selenium.click_element_with_offset( web_element=some_element, x_offset=10, y_offset=-5 ) # Multi-select with shift-click selenium.inclusive_multi_select_elements(web_element_list=[elem1, elem2, elem3]) # Scrolling selenium.scroll_to_element(web_element=target_element) selenium.scroll_to_element( web_element=target_element, behavior=CSS.Behavior.SMOOTH, block=CSS.Block.CENTER ) # Tab management tab_count = selenium.get_tab_count() current_tab = selenium.current_tab_index()selenium.open_new_tab_and_switch_to_it() selenium.switch_to_tab_by_index(zero_based_index=1) selenium.close_current_tab() selenium.close_extra_tabs() # Closes all but first tab # Get viewport dimensions inner_width = selenium.get_inner_width() inner_height = selenium.get_inner_height() # Set viewport size selenium.set_inner_window_dimensions(inner_width=1920, inner_height=1080) # Screenshots screenshot_path = selenium.take_screenshot( directory="Screenshots", screenshot_name="test_failure" ) # Highlighted screenshot (adds red border and yellow background) selenium.take_screenshot_of_element(web_element=failed_element) # Browser navigation selenium.go_back() # Debugging aid selenium.highlight_web_element(web_element=some_element) ``` -------------------------------- ### Button Component - Click and Quality Overlay Awareness Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt The Button component is specifically designed for interacting with Perspective Button elements. It provides a `click()` method with options for offsets and delays, and also offers awareness of quality overlays, allowing for more robust testing of button states and interactions. ```python from selenium.webdriver.common.by import By from selenium.webdriver import Chrome from Components.PerspectiveComponents.Inputs.Button import Button driver = Chrome() # Create a Perspective Button component login_button = Button( locator=(By.CSS_SELECTOR, "div[data-component='ia.input.button']"), driver=driver, timeout=3, description="Login button", raise_exception_for_overlay=False ) # Click the button login_button.click() # Click with offset (useful for specific areas) login_button.click_with_offset(x_offset=10, y_offset=5) # Wait after click for animations login_button.click(wait_after_click=0.5) # Get button text button_text = login_button.get_text() # Check CSS properties background_color = login_button.get_css_property("background-color") ``` -------------------------------- ### PopupHelper - Manage Perspective Popups Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt PopupHelper assists with managing Perspective Popups in automated tests. It allows checking the count of open popups, verifying the presence of modal overlays, and closing all popups if a close icon is configured. ```python from selenium.webdriver import Chrome from Helpers.PerspectivePages.PopupHelper import PopupHelper driver = Chrome() popup_helper = PopupHelper(driver=driver) # Get count of open popups popup_count = popup_helper.get_count_of_all_open_popups() # Check if modal overlay is present has_modal = popup_helper.overlay_is_present() # Close all open popups (requires close icon configured) popup_helper.close_all_popups() ``` -------------------------------- ### Perform Standardized Assertions with IAAssert Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt A comprehensive assertion library designed for clear failure messages and type-aware comparisons. It supports equality, inequality, boolean checks, and collection assertions. ```python from Helpers.IAAssert import IAAssert from selenium.webdriver.support.color import Color # Basic equality assertions IAAssert.is_equal_to( actual_value="hello", expected_value="hello", failure_msg="Values should match" ) # Not equal assertion IAAssert.is_not_equal_to( actual_value=100, expected_value=200, failure_msg="Values should differ" ) # Type-aware comparison (converts both values before comparing) IAAssert.is_equal_to( actual_value="100", expected_value=100, as_type=int, failure_msg="Numeric comparison" ) # Boolean assertions IAAssert.is_true(value=True, failure_msg="Should be truthy") IAAssert.is_not_true(value=False, failure_msg="Should be falsy") # Collection assertions my_list = ["apple", "banana", "cherry"] IAAssert.contains(iterable=my_list, expected_value="banana") IAAssert.does_not_contain(iterable=my_list, expected_value="grape") ``` -------------------------------- ### Interact with Perspective Dropdown Component Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt Provides methods to interact with Perspective Dropdown components, supporting single and multi-select modes. It allows expanding, collapsing, selecting, clearing, and searching options within the dropdown. ```python from selenium.webdriver.common.by import By from selenium.webdriver import Chrome from Components.PerspectiveComponents.Inputs.Dropdown import Dropdown driver = Chrome() # Create a Dropdown component country_dropdown = Dropdown( locator=(By.CSS_SELECTOR, "div[data-component='ia.input.dropdown']"), driver=driver, timeout=4, description="Country selection dropdown" ) # Expand dropdown to show options country_dropdown.expand() # Select an option by text country_dropdown.select_option_by_text_if_not_selected("United States") # Get all currently selected options selected = country_dropdown.get_selected_options_as_list() # Returns: ["United States"] # Get displayed text displayed_text = country_dropdown.get_displayed_text() # Check if expanded is_expanded = country_dropdown.is_expanded() # Collapse dropdown country_dropdown.collapse() # For multi-select dropdowns multi_dropdown = Dropdown( locator=(By.CSS_SELECTOR, "div.multi-select-dropdown"), driver=driver ) # Select multiple options multi_dropdown.select_option_by_text_if_not_selected("Option A") multi_dropdown.select_option_by_text_if_not_selected("Option B") # Clear a specific selection multi_dropdown.clear_selected_option("Option A") # Clear all selections multi_dropdown.clear_all_selections() # Search/filter options multi_dropdown.set_search_text("search term") count = multi_dropdown.get_count_of_displayed_options() # Get placeholder text when nothing selected placeholder = multi_dropdown.get_placeholder_text() ``` -------------------------------- ### View - Perspective View Wrapper Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt The View class wraps Perspective Views, which may or may not be directly accessible via URL (e.g., docked headers/footers). It allows for creating page objects for specific views, checking their presence, and retrieving view resource paths. ```python from selenium.webdriver.common.by import By from selenium.webdriver import Chrome from Pages.Perspective.View import View driver = Chrome() # Create a View (not necessarily a full page) class HeaderView(View): def __init__(self, driver): super().__init__( driver=driver, primary_locator=(By.CSS_SELECTOR, "div[data-view-path='Header']"), view_resource_path="Shared/Header", timeout=10 ) def get_title(self): # Custom view method return self.driver.find_element( By.CSS_SELECTOR, "div.header-title" ).text header = HeaderView(driver) # Check if view is present is_present = header.is_present() # Get view resource path path = header.get_view_resource_path() # Returns: "Shared/Header" ``` -------------------------------- ### Interact with Perspective Table Component Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt Facilitates interaction with Perspective Table components, offering capabilities for cell, row, and column manipulation. It supports retrieving row and cell data, finding rows by value, and inspecting column properties. ```python from selenium.webdriver.common.by import By from selenium.webdriver import Chrome from Components.PerspectiveComponents.Common.Table import Table driver = Chrome() # Create a Table component data_table = Table( locator=(By.CSS_SELECTOR, "div[data-component='ia.display.table']"), driver=driver, timeout=10, description="Data display table" ) # Get row count row_count = data_table.get_count_of_rows() # Wait for specific row count data_table.wait_for_row_count(expected_count=10, timeout=5) # Get cell data by row and column index cell_value = data_table.get_cell_data_by_column_index(row_index=0, column_index=2) # Get cell data by row index and column ID cell_value = data_table.get_cell_data_by_column_id(row_index=0, column_id="username") # Get entire row data as dictionary row_data = data_table.get_row_data(row_index=0) # Returns: {"id": "1", "username": "john", "email": "john@example.com"} # Find row by column value rows = data_table.get_row_data_by_column_value(column_id="username", known_value="john") # Get row index by known value row_index = data_table.get_row_index_of_first_row_with_value_in_column( column_id="username", known_value="john" ) # Get column information column_names = data_table.get_column_names_from_header() column_count = data_table.get_column_count_from_header() column_width = data_table.get_column_width(column_id="username", include_units=False) # Check sorting is_descending = data_table.descending_sort_order_is_active_for_column(column_id="date") sort_order = data_table.get_sort_order_number_of_column(column_id="date") # Check header presence has_header = data_table.header_is_present() # Get cell coordinates for click operations origin = data_table.get_cell_origin(row_index=0, column_index=0) termination = data_table.get_cell_termination(row_index=0, column_index=0) ``` -------------------------------- ### IAAssert: Numeric and Range Comparisons (Python) Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt Provides assertion methods for numeric comparisons like greater than, less than, and range checking. It also includes a method for floating-point comparisons with a specified tolerance and color comparisons across different formats. ```python IAAssert.is_greater_than(left_value=10, right_value=5) IAAssert.is_greater_than_or_equal_to(left_value=10, right_value=10) IAAssert.is_less_than(left_value=5, right_value=10) IAAssert.is_less_than_or_equal_to(left_value=5, right_value=5) IAAssert.is_within_range( low_end_value=0, value=50, high_end_value=100, inclusive=True, failure_msg="Value should be between 0 and 100" ) IAAssert.is_close_to( actual_value=3.14159, expected_value=3.14160, decimal_places=4, failure_msg="Should be close within 4 decimal places" ) IAAssert.is_equal_to( actual_value="rgba(255, 0, 0, 1)", expected_value="#ff0000", as_type=Color ) ``` -------------------------------- ### PagePiece - Reusable Page Components Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt PagePiece is designed as the base class for reusable page components that are shared across multiple pages within an application. It facilitates the creation of modular and maintainable test automation structures. ```python from selenium.webdriver.common.by import By from selenium.webdriver import Chrome from Pages.PagePiece import PagePiece driver = Chrome() ``` -------------------------------- ### IAExpectedConditions: Custom Wait Conditions for Selenium (Python) Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt This snippet demonstrates custom expected conditions for Selenium's WebDriverWait. It includes conditions for functions returning true/false, element text matching (exact or contains), child element existence, and elements being fully in the viewport. It also shows the usage of TextCondition and NumericCondition enums. ```python from selenium.webdriver import Chrome from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from Helpers.IAExpectedConditions.IAExpectedConditions import ( function_returns_true, function_returns_false, element_identified_by_locator_equals_text, element_identified_by_locator_contains_text, element_in_list_contains_text, child_element_exists, element_is_fully_in_viewport, TextCondition, NumericCondition ) driver = Chrome() wait = WebDriverWait(driver, timeout=10) # Wait for custom function to return True def my_condition(): return some_check() wait.until(function_returns_true( custom_function=my_condition, function_args={} )) # Wait with function arguments def check_value(expected): return get_current_value() == expected wait.until(function_returns_true( custom_function=check_value, function_args={"expected": "target_value"} )) # Wait for exact text match element = wait.until(element_identified_by_locator_equals_text( locator=(By.CSS_SELECTOR, "div.status"), text="Complete" )) # Wait for text to contain substring element = wait.until(element_identified_by_locator_contains_text( locator=(By.CSS_SELECTOR, "div.message"), text="Success" )) # Wait for element in list to have text element = wait.until(element_in_list_contains_text( locator=(By.CSS_SELECTOR, "li.item"), text="Target Item" )) # Wait for child element to exist child = wait.until(child_element_exists( parent_web_element=parent_element, child_locator=(By.CSS_SELECTOR, "span.status") )) # Wait for element to be fully visible in viewport wait.until(element_is_fully_in_viewport( driver=driver, locator=(By.CSS_SELECTOR, "div.target") )) # Use TextCondition and NumericCondition enums ``` -------------------------------- ### Check Placeholder Existence Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt Verifies if a placeholder text exists for a given input field. This is useful for validating default states or user guidance in form elements. ```python has_placeholder = username_field.placeholder_text_exists() ``` -------------------------------- ### TextField Component - Input and Text Validation Source: https://context7.com/inductiveautomation/ignition-automation-tools/llms.txt The TextField component facilitates interactions with Perspective Text Field elements, including setting text values and retrieving current content. It incorporates built-in assertion validation for text changes and provides methods to wait for specific text conditions using `IAExpectedConditions`. ```python from selenium.webdriver.common.by import By from selenium.webdriver import Chrome from Components.PerspectiveComponents.Inputs.TextField import TextField from Helpers.IAExpectedConditions.IAExpectedConditions import TextCondition driver = Chrome() # Create a TextField component username_field = TextField( locator=(By.CSS_SELECTOR, "div[data-component='ia.input.text-field']"), driver=driver, timeout=10, description="Username input field" ) # Set text value (automatically clears existing text and validates) username_field.set_text("john.doe@example.com") # Set text without releasing focus (useful for form validation testing) username_field.set_text("partial_input", release_focus=False) # Get current text value current_value = username_field.get_text() # Get placeholder text placeholder = username_field.get_placeholder_text() # Wait for specific text condition final_text = username_field.wait_on_text_condition( text_to_compare="expected_value", condition=TextCondition.EQUALS, timeout=5 ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.