# Not getting the unique object while inspecting the windows dropdown and text object

**URL:** <https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728>\
**Category:** Desktop Testing\
**Tags:** desktop, katalon-studio\
**Created:** [March 19, 2025, 8:00am UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728 "2025-03-19T08:00:07Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![subaldwa](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/subaldwa/32/30227_2.png) [@subaldwa](https://forum.katalon.com/u/subaldwa)\
**Post date:** [March 19, 2025, 8:00am UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728/1 "2025-03-19T08:00:07Z")

</div>

Hi Everyone,

We tried to record our application windows recorder option, when we recorded the workflow for login to the application. The object is “pane” object. when I try to set text to the password field the object is not coming as unique object. All the fields on login screen is coimng as Pane object. Is there any other way to identify the object in windows application?  
We are able to identify the same login screen object through UFT, but through katalon studio we are not able to identify element specific locator.

---

<div class="post-metadata">

**Author:** ![gmarichal](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/gmarichal/32/28810_2.png) [@gmarichal](https://forum.katalon.com/u/gmarichal)\
**Post date:** [March 20, 2025, 1:44am UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728/2 "2025-03-20T01:44:39Z")

</div>

Hello there, could you share more info. about this?

What is the information on the TestObject element (Locator)?  
Have you recorded the test using Windows Recorder or the Native Windows Recorder?  
The test case steps could help also.

---

<div class="post-metadata">

**Author:** ![dineshh](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dineshh/32/24488_2.png) [@dineshh](https://forum.katalon.com/u/dineshh)\
**Post date:** [March 20, 2025, 6:23am UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728/3 "2025-03-20T06:23:37Z")

</div>

To resolve issues with identifying **non-unique Windows application objects** (like password fields) in Katalon Studio when they appear as generic “Pane” elements:

## 1. **Why This Happens**

- **Reason** : Windows apps built with frameworks (e.g., WinForms, WPF) may not expose accessibility properties (like `AutomationId` or `Name`), leading Katalon’s recorder to label elements as generic “Pane” objects.
- **UFT vs. Katalon** : Tools like UFT often use different engines (e.g., UIAutomation vs. MSAA) or custom plugins to handle such cases.

## 2. **Solution 1: Manually Define XPath for Elements**

Use **Windows Spy** or **Inspect.exe** tool to identify unique properties and build custom XPaths.

**Steps** :

1. **Open Windows Spy** :

- Launch Katalon Studio → **Start Windows Spy**.

1. **Identify Properties** :

- Hover over the password field and note:
  - `ClassName`, `Name`, `AutomationId`, `ControlType`.

1. **Build XPath** :

xml

```auto
//Pane[@ClassName='Edit' and @Name='Password']

```

1. **Add to Object Repository** :

- Create a new Windows test object.
- Set **Locator** to **XPath** and paste your custom XPath.

## 3. **Solution 2: Use `AutomationId` or `Name` Properties**

If your app exposes `AutomationId` or `Name`:

groovy

```auto
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows

// For AutomationId:
Windows.setText(findWindowsObject("Object Repository/PasswordField"), "your_password", 
    [:], 
    ["AutomationId": "txtPassword"]) // Replace with actual AutomationId

// For Name:
Windows.setText(findWindowsObject("Object Repository/PasswordField"), "your_password", 
    [:], 
    ["Name": "Password"])

```

## 4. **Solution 3: Use Windows Accessibility Tools**

Tools like **Inspect.exe** or **UI Automation Verify** can reveal hidden properties:

1. Download **Inspect.exe** from the [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/).
2. Run the tool and inspect the password field.
3. Look for properties like `RuntimeId`, `ControlType`, or `LocalizedControlType`.

## 5. **Solution 4: Update Katalon and Plugins**

- **Update Katalon** to the [latest version](https://docs.katalon.com/katalon-studio/docs/installation-upgrade.html).
- Install/Update the **Windows Desktop Application Plugin** (if missing).

## 6. **Solution 5: Use Coordinates (Last Resort)**

If no unique properties exist, use `clickOffset` with coordinates relative to the parent pane:

groovy

```auto
Windows.clickOffset(findWindowsObject("Object Repository/Pane"), 100, 50) // Adjust coordinates
Windows.setText(findWindowsObject("Object Repository/Pane"), "your_password")

```

## 7. **Compare with UFT’s Approach**

If UFT works, replicate its identification logic:

- **UFT Property** : Check which properties UFT uses (e.g., `micClass`, `nativeClass`).
- **Map to Katalon** : Use equivalent properties in Katalon’s test object.

## Example Workflow for Password Field:

groovy

```auto
// Wait for the login pane
Windows.waitForElementPresent(findWindowsObject("Object Repository/LoginPane"), 20)

// Use custom XPath to identify the password field
Windows.setText(findWindowsObject("Object Repository/PasswordField"), "your_password", 
    [:], 
    ["XPath": "//Pane[@Name='PasswordInput']"])

// Click login button
Windows.click(findWindowsObject("Object Repository/LoginButton"))

```

## Key Notes:

- **Refresh Object Repository** : If the UI changes, re-spy objects.
- **Add Delays** : Use `Windows.delay(2)` if elements load dynamically.
- **Check for Updates** : Some Windows apps (e.g., Java Swing) require accessibility fixes from the development team

---

<div class="post-metadata">

**Author:** ![subaldwa](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/subaldwa/32/30227_2.png) [@subaldwa](https://forum.katalon.com/u/subaldwa)\
**Post date:** [March 20, 2025, 7:59am UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728/4 "2025-03-20T07:59:57Z")

</div>

We tried to test using both Windows recorder as well as Native windows recorder .  
But we are not able to identify the unique object for the login fields.

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/2/b/2b0b24eb90ab1e04123330ac7f6945c372497e91.png)

For both User and password field we are getting Pane object without any xpath or name .  
There is no information on TestObject element

---

<div class="post-metadata">

**Author:** ![Dan\_Bown](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dan_bown/32/20464_2.png) [@Dan\_Bown](https://forum.katalon.com/u/Dan_Bown)\
**Post date:** [March 20, 2025, 11:49am UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728/5 "2025-03-20T11:49:01Z")

</div>

I would approach the exercise as a POC rather than assuming that Katalon will be able to automate it. The approach to locators makes things significantly slower than web automation and it may be that the app just won’t work.  
I had an app that crashed WinAppDriver and therefore any tool that tried to view the app - this went for Inspect.exe as well as Katalon. Gave up in the end, it was just cheaper to run tests manually.  
Note that Katalon 10.x doesn’t currently support Windows apps.

---

<div class="post-metadata">

**Author:** ![gmarichal](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/gmarichal/32/28810_2.png) [@gmarichal](https://forum.katalon.com/u/gmarichal)\
**Post date:** [March 20, 2025, 1:51pm UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728/6 "2025-03-20T13:51:58Z")

</div>

Yeah, Windows automation is a challenge nowadays

---

<div class="post-metadata">

**Author:** ![subaldwa](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/subaldwa/32/30227_2.png) [@subaldwa](https://forum.katalon.com/u/subaldwa)\
**Post date:** [March 25, 2025, 7:09am UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728/7 "2025-03-25T07:09:32Z")

</div>

Hi Dinesh,

We tried your solution and successfully retrieved the **AutomationId** for the password field using **inspect.exe**. However, we are unable to use it with the following approach:

groovy

CopyEdit

```auto
// Attempt to use AutomationId
Windows.setText(findWindowsObject("Object Repository/PasswordField"), "your_password", 
    [:], 
    ["AutomationId": "txtPassword"]) // Replace with actual AutomationId

```

Since **Katalon Studio** does not support `setText` with these arguments, this method does not work.

We also attempted to use **AutomationId in XPath** , but encountered the following error:

pgsql

CopyEdit

```auto
Caused by: org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.
(WARNING: The server did not provide any stacktrace information)
At object: 'Object Repository/password'

```

**XPath used:**

xpath=  
//Pane[@AutomationId=‘txtPassword’]

Could you please guide us on how to correctly use **AutomationId as an XPath locator** to find the element on the screen?

---

<div class="post-metadata">

**Author:** ![dineshh](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dineshh/32/24488_2.png) [@dineshh](https://forum.katalon.com/u/dineshh)\
**Post date:** [March 25, 2025, 8:05am UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728/8 "2025-03-25T08:05:56Z")

</div>

To resolve the **AutomationId XPath issue** in Katalon Studio for Windows applications:

## **Issue 1: Incorrect XPath Syntax for AutomationId**

The `AutomationId` property must be referenced using Katalon’s Windows test object syntax (not direct XPath).

1. **Use the `automationId` Attribute**  
XPath requires the exact attribute exposed by the app. For Windows apps using **UI Automation** , the attribute is `automationId` (lowercase “i”):

```auto
//*[@automationId='txtPassword']

```

- **No “Pane” restriction** (use `*` to match any element type with that ID).

1. **Create a Defined Test Object**  
Don’t use raw XPath in scripts. Define it in the **Object Repository** :

- In Katalon Studio:
  1. Right-click the object in the Repository → **New → Windows Test Object**.
  2. Set **Locator** to **XPath**.
  3. Paste your XPath: `//*[@automationId='txtPassword']`.

1. **Wait for Element & Use the Object**

```auto
// Wait for the password field to exist
Windows.waitForElementPresent(findWindowsObject("Object Repository/PasswordField"), 20)

// Set text using the predefined object
Windows.setText(findWindowsObject("Object Repository/PasswordField"), "your_password")

```

## **Issue 2: Script Argument Mismatch**

The original code attempted to pass `AutomationId` as a runtime parameter, which is **not supported** by `Windows.setText()`. Instead:

**Use AutomationId in Test Object Properties**

- When creating/editing the test object in the Repository, add `automationId` as a **property** :
- Katalon will automatically prioritize `AutomationId` for identification.

## **Example Workflow**

1. **Identify with Inspect.exe** :  
Confirm the `AutomationId="txtPassword"` exists and is unique.
2. **Object Repository Setup** :

```auto
//*[@automationId='txtPassword']

```

1. **Script** :

```auto
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows

// Wait for login window
Windows.waitForElementPresent(findWindowsObject("Object Repository/LoginWindow"), 10)

// Set password using AutomationId-based object
Windows.setText(findWindowsObject("Object Repository/PasswordField"), "your_password")

```

## **Troubleshooting**

- **Element Not Found Error** :
  - Confirm the XPath matches **Inspect.exe’s hierarchy** (e.g., nested containers may require absolute paths):

```auto
//Pane[@Name='LoginPanel']//*[@automationId='txtPassword']

```

- Add delays if the element loads dynamically:

```auto
Windows.delay(2)

```

- **Alternative for Legacy Apps** :  
If `automationId` isn’t exposed, use `RuntimeId` (unique per session):

```auto
//*[@runtimeId='42.199356.4.1']

```

## **Why UFT Works But Katalon Struggles**

UFT often uses **property-based identification** (e.g., `nativeClass`), while Katalon relies on XPath or preconfigured object properties. Always map UFT-identified attributes to Katalon’s syntax.

**Key Takeaway** : Define AutomationId in the Object Repository, not inline in scripts.

---

<div class="post-metadata">

**Author:** ![subaldwa](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/subaldwa/32/30227_2.png) [@subaldwa](https://forum.katalon.com/u/subaldwa)\
**Post date:** [March 25, 2025, 3:17pm UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728/9 "2025-03-25T15:17:54Z")

</div>

Hi Dineshh,

We tried using the following XPath approach, where **@automationId** is unique:

xpath=

```auto
//*[@automationId='txtPassword']

```

However, we encountered the following issue:

```auto
Unable to set text for object 'Object Repository/password'
(Root cause: org.openqa.selenium.TimeoutException: Expected condition failed: 
waiting for com.kms.katalon.core.windows.keyword.helper.WindowsActionHelper$1@510da778 
(tried for 30 second(s) with 50 milliseconds interval))

```

We also attempted to refine the locator strategy by adding additional **unique properties** in XPath, but we are still unable to set the text successfully.

even tried using delay which you suggested in the above chat.

Could you please advise on the correct approach to use **automationId in XPath** for identifying the element and setting text in **Katalon Studio**?

Looking forward to your guidance.

---

<div class="post-metadata">

**Author:** ![dineshh](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dineshh/32/24488_2.png) [@dineshh](https://forum.katalon.com/u/dineshh)\
**Post date:** [March 26, 2025, 6:21am UTC](https://forum.katalon.com/t/not-getting-the-unique-object-while-inspecting-the-windows-dropdown-and-text-object/168728/10 "2025-03-26T06:21:47Z")

</div>

To resolve the **TimeoutException** and successfully use `automationId` in XPath, follow these steps:

## ⚠ **Key Issues Identified** :

1. **Hierarchy/Context Issues** : The element exists in a container (e.g., `Pane`, `Window`) not referenced in XPath.
2. **Element Not Interactable** : The element is present but not enabled/visible when the script runs.
3. **Static Delays Insufficient** : Delays alone won’t address dynamic UI loading; explicit waits are required.

## **Step 1: Verify Full Element Hierarchy**

Use **Inspect.exe** to confirm the element’s parent-child relationship.  
**Example Structure** :

```auto
Window (Parent)
  → Pane[@Name="LoginPanel"]
    → Edit[@automationId="txtPassword"] // Target element

```

## **Step 2: Refine XPath with Parent Context**

If nested, include parent containers to avoid ambiguity:

```auto
//Pane[@Name='LoginPanel']//*[@automationId='txtPassword']  
//Window//Edit[@automationId='txtPassword'] // Explicit control type (`Edit`)

```

## **Step 3: Create a Robust Test Object**

**Avoid raw XPath in scripts** ; define a test object in the repository:

1. **Object Repository → New → Windows Test Object**.
2. **Add Property** :

- **Name** : `automationId` (lowercase “i”)
- **Value** : `txtPassword`
- _No need for XPath!_

## **Step 4: Script with Explicit Waits and Focus**

```auto
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows

// Wait for parent window first (critical!)
Windows.waitForElementPresent(findWindowsObject("LoginWindow"), 30)

// Optional: Focus parent container
Windows.focus(findWindowsObject("LoginWindow"))

// Wait for password field to be interactable (not just present!)
Windows.waitForElementClickable(findWindowsObject("PasswordField"), 30)

// Set text using the test object
Windows.setText(findWindowsObject("PasswordField"), "your_password")

```

## **Step 5: Advanced Troubleshooting**

If the error persists:

## A. **Check if the Element is Enabled**

```auto
def element = Windows.findElement(findWindowsObject("PasswordField"))
assert Windows.elementEnabled(element) == true

```

## B. **Use Absolute XPath Temporarily**

Extract the full path from **Inspect.exe** (e.g., for debugging):

```auto
//Window[@Name='Login']/Pane[@automationId='mainPanel']/Edit[@automationId='txtPassword']

```

## C. **RuntimeId Fallback**

If `automationId` is unreliable (e.g., dynamic), use `runtimeId` from Inspect.exe:

```auto
//*[@runtimeId='42.12345.4.1']

```

## 🔍 **Why This Happens** :

- **TimeoutException** : The element exists but is in a container not yet loaded or focused.
- **XPath Flakiness** : Parent containers may change dynamically, breaking generic XPaths like `//*[@automationId=...]`.

## ✅ **Validation Checklist**

| Scenario | Solution |
| --- | --- |
| XPath works in Inspect.exe | Use parent-child hierarchy in XPath. |
| Element not interactable | Use `waitForElementClickable()`, not `waitForElementPresent()`. |
| Delays not working | Replace static `delay()` with explicit waits. |

## **Final Script Example**

```auto
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows

// 1. Wait for parent window
Windows.waitForElementPresent(findWindowsObject("LoginWindow"), 30)

// 2. Focus parent container (critical for nested elements)
Windows.focus(findWindowsObject("LoginWindow"))

// 3. Wait for password field to be interactable
Windows.waitForElementClickable(findWindowsObject("PasswordField"), 30)

// 4. Set text
Windows.setText(findWindowsObject("PasswordField"), "your_password")

```

Define `automationId` in test objects, focus parent containers, and prioritize `waitForElementClickable()` over static delays. If issues persist, share a screenshot of the element hierarchy from **Inspect.exe**
