1. Data Manipulation: Collections (Arrays & Lists)

When a single variable isn't enough, collections are used to store multiple data points. Highly testable in programming questions.

  • Definition: A collection is a complex data structure that allows a developer to store multiple values of the exact same data type under a single variable name.
  • Array Characteristics: An Array is a fixed-size collection. The developer must know and declare the exact number of items it will hold at the time of its creation (e.g., New String(4){} creates an array for 5 items).
  • List Characteristics: A List is a dynamic collection. Items can be added, removed, or sorted at runtime without needing to pre-define a maximum size constraint.
  • Initialization Requirement: Collections (especially Lists) must be formally initialized using the Assign activity (e.g., myList = New List(of String)) before data can be added, otherwise the bot will throw a "Null Reference" exception.
  • Zero-Based Indexing: Data inside collections is accessed using an index number, and the counting always starts at zero. The first item is accessed via myArray(0).
  • Traversal Mechanism: The For Each activity is the standard, specialized control flow used to systematically iterate through every item in an array or list from start to finish.
2. Act on a Control: Input Methods

This section details how the robot physically interacts with the user interface. Often appears as a 6-mark comparison question.

  • Default Method: Relies on the standard Windows messaging system. It is highly compatible but has a major drawback: it requires the target application window to be open and in the foreground to work.
  • SendWindowMessages Method: Bypasses the active window requirement by sending instructions directly to the target application's message loop. It can successfully type or click even if the window is hidden in the background.
  • Simulate Type/Click Method: The fastest and most highly recommended method for web automation. It interacts directly with the target application's API, works in the background, and does not rely on the physical mouse cursor.
  • Hardware Events: Simulates physical keyboard and mouse drivers. It is the slowest method and cannot work in the background, but it is a necessary fallback when the other software-based methods fail on strict security applications.
  • Empty Field Property: A critical configuration checkbox within the "Type Into" activity that automatically deletes any pre-existing text in a text box before the robot begins typing the new string.
  • Click Before Typing Property: A reliability feature that instructs the robot to perform a single mouse click inside the target UI element to guarantee it has active focus before sending keystrokes.
3. Advanced UI: Finding Controls & Anchors

When dynamic interfaces cause standard "Click" activities to fail, these advanced targeting activities must be utilized.

  • Find Element Activity: Halts the workflow execution until a specifically defined UI element appears on the screen, and then outputs that element as a reusable UiElement variable.
  • Find Image Activity: Searches the screen for a specific visual graphic (a cluster of pixels) rather than searching for underlying HTML/XML code. Crucial for Citrix or Flash-based environments.
  • Anchor Base Concept: A container activity used when the primary target (like a blank text box) has an unstable or randomized ID that changes every time the page loads.
  • Anchor Base Execution: The robot first searches for a reliable, unchanging "Anchor" (like a static "First Name:" label), and then performs the action on the target located relative to that anchor.
  • Element Exists Activity: A non-blocking activity that checks if an element is currently visible. It does not crash if the element is missing; instead, it outputs a simple Boolean (True/False), making it perfect for conditional If logic.
  • Highlight Activity: A visual debugging tool that draws a highly visible, colored border (usually red) around a specified UI element during execution to visually confirm the robot has targeted the correct item.
4. Screen Scraping Extraction Methods

Screen scraping is used to pull unstructured text blocks from interfaces. Developers must choose between three distinct scraping engines.

  • FullText Method (Speed): This is the default and absolute fastest scraping method. It operates flawlessly in the background and is capable of extracting text that is hidden from the user's view.
  • FullText Method (Limitation): The primary drawback of FullText is that it strips away all screen formatting and completely ignores the spatial coordinates (x,y positioning) of the text on the screen.
  • Native Method: Specifically designed to extract text from applications built using the Graphics Device Interface (GDI). It successfully captures text position, color, and formatting.
  • Native Method (Limitation): Unlike FullText, Native scraping is significantly slower and strictly requires the application window to be visible in the foreground.
  • OCR Method (Optical Character Recognition): The only scraping method capable of extracting text from flat image files, scanned PDFs, or entirely virtualized environments (Citrix/RDP).
  • OCR Method (Dependencies): OCR is not 100% accurate. Its success heavily depends on the language model installed, the quality of the image, and adjusting the Scale property to artificially enlarge small text.
5. Avoiding Typical Failure Points (Best Practices)

A critical theoretical topic addressing why bots crash in production and how to build resilient automation architectures.

  • Eliminating Hardcoded Paths: Bots fail when moved to different computers if file paths are absolute (e.g., C:\Users\John\...). Prevent this by using dynamic system paths via Environment.GetFolderPath.
  • Managing Timeouts: A bot will hang indefinitely if an application fails to load. Developers must manually configure the TimeoutMS property in UI activities to force an error and move on if an element doesn't appear within a set timeframe (default is 30,000ms).
  • Dynamic Selectors (Wildcards): Application updates often change window titles (e.g., "Invoice 1234" to "Invoice 5678"). Prevent failure by replacing the volatile numbers with an asterisk wildcard (*) in UiExplorer.
  • Exception Handling Containers: Unexpected pop-ups crash linear sequences. Enclosing risky actions (like web scraping) inside a Try Catch block allows the bot to "catch" the error, log it, and gracefully recover without shutting down entirely.
  • Static Delays vs Dynamic Waits: Using fixed Delay activities slows down the bot unnecessarily. Replacing them with dynamic synchronization (e.g., Wait Element Appear) ensures the bot acts the exact millisecond the application is ready.
  • Resolution Standardization: Automations that rely on Image Recognition or Citrix recording will instantly fail if deployed on a monitor with a different resolution or DPI scaling. Ensure Development and Production machines share identical display settings.