|
| 1 | +--- |
| 2 | +id: kaneai-smart-locator-priority |
| 3 | +title: Smart Locator Priority |
| 4 | +hide_title: false |
| 5 | +sidebar_label: Smart Locator Priority |
| 6 | +description: Learn how to configure Smart Locator Priority in KaneAI Org Product Preferences so your organization can define which locator strategy should take precedence during Smart Locator resolution. |
| 7 | +keywords: |
| 8 | + - kaneai smart locator priority |
| 9 | + - locator priority |
| 10 | + - org product preferences |
| 11 | + - kane ai organization settings |
| 12 | + - css selector priority |
| 13 | + - xpath priority |
| 14 | +url: https://www.testmuai.com/support/docs/kaneai-smart-locator-priority/ |
| 15 | +site_name: TestMu AI |
| 16 | +slug: kaneai-smart-locator-priority/ |
| 17 | +canonical: https://www.testmuai.com/support/docs/kaneai-smart-locator-priority/ |
| 18 | +--- |
| 19 | + |
| 20 | +import BrandName, { BRAND_URL } from '@site/src/component/BrandName'; |
| 21 | + |
| 22 | +<script type="application/ld+json" |
| 23 | + dangerouslySetInnerHTML={{ __html: JSON.stringify({ |
| 24 | + "@context": "https://schema.org", |
| 25 | + "@type": "BreadcrumbList", |
| 26 | + "itemListElement": [{ |
| 27 | + "@type": "ListItem", |
| 28 | + "position": 1, |
| 29 | + "name": "Home", |
| 30 | + "item": BRAND_URL |
| 31 | + },{ |
| 32 | + "@type": "ListItem", |
| 33 | + "position": 2, |
| 34 | + "name": "Support", |
| 35 | + "item": `${BRAND_URL}/support/docs/` |
| 36 | + },{ |
| 37 | + "@type": "ListItem", |
| 38 | + "position": 3, |
| 39 | + "name": "KaneAI Smart Locator Priority", |
| 40 | + "item": `${BRAND_URL}/support/docs/kaneai-smart-locator-priority/` |
| 41 | + }] |
| 42 | + }) |
| 43 | + }} |
| 44 | +></script> |
| 45 | + |
| 46 | +# Smart Locator Priority |
| 47 | + |
| 48 | +Smart Locator Priority lets your organization define the order in which KaneAI should prefer supported locator strategies inside the **Smart Locator** workflow. |
| 49 | + |
| 50 | +This is useful when your application is more stable with one locator type over another and you want that preference applied consistently at the organization level. |
| 51 | + |
| 52 | +## What It Does |
| 53 | + |
| 54 | +Smart Locator currently supports prioritizing these locator strategies: |
| 55 | + |
| 56 | +1. **CSS selector** |
| 57 | +2. **XPath** |
| 58 | + |
| 59 | +The locator type placed at the top of the list is given higher priority than the locator types below it. |
| 60 | + |
| 61 | +For example: |
| 62 | + |
| 63 | +- If **CSS selector** is placed above **XPath**, KaneAI will prefer CSS selector first. |
| 64 | +- If **XPath** is moved to the top, KaneAI will prefer XPath first. |
| 65 | + |
| 66 | +## Why This Matters |
| 67 | + |
| 68 | +Different applications behave better with different locator strategies. |
| 69 | + |
| 70 | +You may want to adjust the default order if: |
| 71 | + |
| 72 | +- your application generates more stable CSS selectors than XPath expressions |
| 73 | +- your current pages rely more heavily on XPath-based resolution |
| 74 | +- your team wants one consistent Smart Locator strategy across the organization |
| 75 | + |
| 76 | +## Where to Find It |
| 77 | + |
| 78 | +You can configure Smart Locator Priority from: |
| 79 | + |
| 80 | +1. **Organization Settings** |
| 81 | +2. **Org Product Preferences** |
| 82 | +3. **Kane AI** |
| 83 | +4. **Smart locator priority** |
| 84 | + |
| 85 | +Direct access link: |
| 86 | + |
| 87 | +- [Open Smart Locator Priority in Organization Settings](https://accounts.lambdatest.com/org-settings/kane-ai/smart-locator-priority) |
| 88 | + |
| 89 | +The following screen shows where the setting is located inside Organization Settings: |
| 90 | + |
| 91 | +<img |
| 92 | + loading="lazy" |
| 93 | + src={require('../assets/images/kane-ai/features/smart-locator-priority.png').default} |
| 94 | + alt="Smart Locator Priority in KaneAI Org Product Preferences" |
| 95 | + className="doc_img" |
| 96 | +/> |
| 97 | + |
| 98 | +## How to Configure Smart Locator Priority |
| 99 | + |
| 100 | +1. Open **Organization Settings** in <BrandName />. |
| 101 | +2. Navigate to **Org Product Preferences**. |
| 102 | +3. Expand the **Kane AI** section in the left navigation. |
| 103 | +4. Open **Smart locator priority**. |
| 104 | +5. Drag and drop the supported locator types into your preferred order. |
| 105 | +6. Keep the most preferred locator strategy at the top of the list. |
| 106 | + |
| 107 | +Once updated, the new order becomes the organization-level Smart Locator preference. |
| 108 | + |
| 109 | +## Current Supported Locator Types |
| 110 | + |
| 111 | +At the moment, the UI supports these locator types: |
| 112 | + |
| 113 | +- **CSS selector** |
| 114 | +- **XPath** |
| 115 | + |
| 116 | +The design is intended to support additional locator types in the future. |
| 117 | + |
| 118 | +## Organization-Level Behavior |
| 119 | + |
| 120 | +Smart Locator Priority is configured at the organization level so teams can keep one shared preference for locator resolution behavior. |
| 121 | + |
| 122 | +:::note |
| 123 | +This setting is intended for organization-wide KaneAI behavior and is typically managed by organization admins. |
| 124 | +::: |
| 125 | + |
| 126 | +## Recommended Default Approach |
| 127 | + |
| 128 | +If you do not have a strong reason to change the order, keep the default order that works best for your team’s application stability. |
| 129 | + |
| 130 | +In most cases: |
| 131 | + |
| 132 | +- use **CSS selector** first when your application has stable DOM structure and consistent attributes |
| 133 | +- use **XPath** first only when your workflows depend heavily on XPath-based targeting |
| 134 | + |
| 135 | +## Best Practices |
| 136 | + |
| 137 | +- Choose one order for your organization and avoid changing it too frequently. |
| 138 | +- Validate the preferred strategy on a few representative KaneAI flows before standardizing it across teams. |
| 139 | +- If locator behavior changes after a UI update in your product, review whether the current priority order is still appropriate. |
| 140 | + |
| 141 | +## Limitations |
| 142 | + |
| 143 | +- This setting currently supports only the locator strategies shown in the UI. |
| 144 | +- The priority order controls which locator type is preferred first; it does not replace the need for stable page structure and reliable element identification. |
| 145 | + |
| 146 | +## Related Docs |
| 147 | + |
| 148 | +- [Failure Conditions](/support/docs/kaneai-failure-conditions/) |
| 149 | +- [KaneAI Command Guide](/support/docs/kane-ai-command-guide/) |
| 150 | +- [Custom Instructions in KaneAI Test Generation](/support/docs/generate-test-cases/) |
0 commit comments