|
| 1 | +--- |
| 2 | +id: hyperexecute-yaml-capability-overrides |
| 3 | +title: YAML-Based Capability Overrides for Selenium Tests on HyperExecute |
| 4 | +hide_title: false |
| 5 | +sidebar_label: Override Capabilities in YAML |
| 6 | +description: "Easily override test capabilities using YAML in HyperExecute. No script changes needed. Flexible, scalable, and ideal for dynamic test environments." |
| 7 | +keywords: |
| 8 | + - LambdaTest Hyperexecute |
| 9 | + - LambdaTest Hyperexecute help |
| 10 | + - LambdaTest Hyperexecute documentation |
| 11 | +url: https://www.lambdatest.com/support/docs/hyperexecute-yaml-capability-overrides/ |
| 12 | +site_name: LambdaTest Deep dive into hyperexecute yaml |
| 13 | +slug: hyperexecute-yaml-capability-overrides/ |
| 14 | +--- |
| 15 | +import Tabs from '@theme/Tabs'; |
| 16 | +import TabItem from '@theme/TabItem'; |
| 17 | + |
| 18 | +<script type="application/ld+json" |
| 19 | + dangerouslySetInnerHTML={{ __html: JSON.stringify({ |
| 20 | + "@context": "https://schema.org", |
| 21 | + "@type": "BreadcrumbList", |
| 22 | + "itemListElement": [{ |
| 23 | + "@type": "ListItem", |
| 24 | + "position": 1, |
| 25 | + "name": "Home", |
| 26 | + "item": "https://www.lambdatest.com" |
| 27 | + },{ |
| 28 | + "@type": "ListItem", |
| 29 | + "position": 2, |
| 30 | + "name": "Support", |
| 31 | + "item": "https://www.lambdatest.com/support/docs/" |
| 32 | + },{ |
| 33 | + "@type": "ListItem", |
| 34 | + "position": 3, |
| 35 | + "name": "YAML Based Capability Overrides", |
| 36 | + "item": "https://www.lambdatest.com/support/docs/hyperexecute-yaml-capability-overrides/" |
| 37 | + }] |
| 38 | + }) |
| 39 | + }} |
| 40 | +></script> |
| 41 | +In Selenium-based testing, [capabilities](https://www.lambdatest.com/support/docs/selenium-automation-capabilities/) are key-value pairs that define how and where your tests should run—such as browser type, version, OS, console logs, video recording, and more. |
| 42 | + |
| 43 | +Previously, these capabilities were typically defined within the test script. With this new feature, you can now override or inject these directly from your **HyperExecute YAML** file. This gives you greater flexibility and eliminates the need to modify test scripts every time you change execution parameters. |
| 44 | + |
| 45 | +## 🚀 Why Use YAML-Based Overrides? |
| 46 | +| Benefit | Description | |
| 47 | +| ---------------------------- | -------------------------------------------------------------------------- | |
| 48 | +| No Code Changes Required | Easily change capabilities without modifying your test script. | |
| 49 | +| Reusable & Configurable | Use a single script across different environments with varying YAML files. | |
| 50 | +| Cleaner Test Scripts | Keeps your scripts capability-agnostic and environment-independent. | |
| 51 | + |
| 52 | +## ⚙️ How It Works |
| 53 | +- Define a new `ltOptions` section inside your HyperExecute YAML file. |
| 54 | +- Specify any desired capabilities as key-value pairs under `ltOptions`. |
| 55 | +- During test execution, HyperExecute automatically merges these with the final capabilities passed to the Selenium session. |
| 56 | +> All the capabilities defined under the `ltOptions` section are fully aligned with LambdaTest's standard capability structure. You can use any capability listed in our [LambdaTest Capabilities Generator](https://www.lambdatest.com/capabilities-generator/). |
| 57 | +
|
| 58 | +## 🔑 Key Behavior Rules |
| 59 | + |
| 60 | +| Case | Behavior | |
| 61 | +| --------------------------------------------------- | ---------------------------------------------------------- | |
| 62 | +| Capability present in **both test script and YAML** | The **YAML value takes precedence**. | |
| 63 | +| Capability present in **YAML but not in script** | It is **automatically added** to the session capabilities. | |
| 64 | +| Capability only in script | Used as-is unless overridden in YAML. | |
| 65 | + |
| 66 | +> **📝 Note:** This feature is only supported for **Selenium**-based tests at the moment. |
| 67 | +
|
| 68 | +## Sample YAML with Capability Overrides |
| 69 | + |
| 70 | +```yaml reference title="hyperexecute.yaml" |
| 71 | +https://github.com/LambdaTest/testng-selenium-hyperexecute-sample/blob/main/yaml/linux/v1/testng_hyperexecute_linux_ltoptions.yaml |
| 72 | +``` |
| 73 | + |
| 74 | +## 💡 Common Use Cases |
| 75 | + |
| 76 | +| Use Case | Example Capability | |
| 77 | +| ----------------------------- | ---------------------------- | |
| 78 | +| Changing browser type/version | `browserName`, `version` | |
| 79 | +| Controlling visual artifacts | `video`, `console`, `visual` | |
| 80 | +| Defining test metadata | `build`, `name` | |
| 81 | +| Network capture and debugging | `network`, `tunnel` | |
| 82 | +| Switching Selenium versions | `selenium_version` | |
0 commit comments