Ask AI
Skip to main content

Get input element by code

Function: Get input element by code

This action helps you find a specific user interface (UI) element within your application's forms or pages by using its unique identifier, known as its "code." This is particularly useful when you need to interact with a specific part of your application's interface, like a dropdown menu or a text input field, but you only know its internal code.

Input

  • Code (STRING): The unique identifier (code) of the UI element you want to find. This is a piece of text that uniquely identifies the element on your page.

Output

  • Element (PART): This output provides the name of the variable that now holds the found UI element (specifically a dropdown field). You can use this variable name in subsequent actions to access the actual UI element.

Execution Flow

Real-Life Examples

Here are some examples of how you can use the "Get input element by code" action:

  1. Example: Pre-filling a User Registration Form

    • Scenario: You have a user registration form, and you want to automatically select a default country in a "Country" dropdown field based on the user's IP address. You know the dropdown's internal code is COUNTRY_DROPDOWN.
    • Inputs:
      • Code: COUNTRY_DROPDOWN
    • Result: The action finds the "Country" dropdown field. The output "Element" will provide the name of a variable (e.g., foundCountryDropdown) that now holds this dropdown field. You can then use foundCountryDropdown in a subsequent action to set its value to "United States".
  2. Example: Validating a Product Quantity Field

    • Scenario: On a product order page, you need to ensure that the "Quantity" input field (which has the code PRODUCT_QUANTITY) is always a positive number before the user can proceed.
    • Inputs:
      • Code: PRODUCT_QUANTITY
    • Result: The action successfully locates the "Quantity" input field. The output "Element" will provide the name of a variable (e.g., quantityInput) that holds this field. You can then use quantityInput to retrieve its current value and perform a validation check.
  3. Example: Dynamically Updating a Shipping Method Selector

    • Scenario: You have an e-commerce checkout page where the available "Shipping Method" dropdown (code SHIPPING_METHOD) needs to change its options based on the selected delivery address.
    • Inputs:
      • Code: SHIPPING_METHOD
    • Result: The action identifies the "Shipping Method" dropdown. The output "Element" will provide the name of a variable (e.g., shippingSelector) that holds this dropdown. You can then use shippingSelector to dynamically update its available options based on other data in your application.