SmartUI Hooks: Layout, Full-Page Screenshots, and Smart Ignore
Use this page when you run SmartUI Hooks on LambdaTest (for example Selenium executeScript without the smartui exec CLI wrapper) and need layout comparison, full-page capture, or Smart Ignore.
For Hooks, engineering behavior is:
| Goal | Where to configure | Notes |
|---|---|---|
| Layout comparison | smartui.takeScreenshot hook options (per screenshot) | Pass ignoreType: ["layout"] (and related layout flags) in the Map/object passed to executeScript("smartui.takeScreenshot", options). Layout is not enabled for Hooks by setting layout fields only in LT:Options capabilities—that path is not supported the way teams often expect. |
| Smart Ignore | LT:Options | Set smartUI.smartIgnore: true on the session for baseline and comparison runs. |
| Project | LT:Options | Set smartUI.project (and visual, auth) as usual. |
If you need layout via capabilities alone (no hook options), treat that as a product / roadmap ask—track with your account team (for example internal idea LTPM-3632). This doc reflects current Hooks behavior.
With Smart Ignore, use either Ignore DOM or Select DOM in the dashboard where applicable—not both on the same flow.
1. Session capabilities (LT:Options)
Always (Hooks)
username,accessKey,visual: true,smartUI.project
Smart Ignore (Hooks)
Set on LT:Options for the whole session (baseline and comparison):
import java.util.HashMap;
import org.openqa.selenium.chrome.ChromeOptions;
ChromeOptions browserOptions = new ChromeOptions();
HashMap<String, Object> ltOptions = new HashMap<>();
ltOptions.put("username", System.getenv("LT_USERNAME"));
ltOptions.put("accessKey", System.getenv("LT_ACCESS_KEY"));
ltOptions.put("visual", true);
ltOptions.put("smartUI.project", "Your_Project_Name");
ltOptions.put("smartUI.smartIgnore", true);
browserOptions.setCapability("LT:Options", ltOptions);
JavaScript / Node
'LT:Options': {
user: process.env.LT_USERNAME,
accessKey: process.env.LT_ACCESS_KEY,
visual: true,
'smartUI.project': 'Your_Project_Name',
'smartUI.smartIgnore': true,
},
C#
capabilities.SetCapability("visual", true);
capabilities.SetCapability("smartUI.project", "Your_Project_Name");
capabilities.SetCapability("smartUI.smartIgnore", true);
These patterns do not turn on Smart Ignore reliably:
ltOptions.put("ignoreType", Arrays.asList("smartignore"));withoutsmartUI.smartIgnoreltOptions.put("smartignore", true);at the root ofLT:Options
Use smartUI.smartIgnore: true only.
Layout — not via standalone layout capabilities for Hooks
Do not expect ignoreType: ["layout"], smartUI.layout, or nested smartUI.options layout blocks alone in LT:Options to enable layout comparison for Hooks. Validated behavior is: pass layout in the hook (next section).
2. Layout comparison — pass options to smartui.takeScreenshot
Pass a single map to executeScript("smartui.takeScreenshot", options) including screenshotName and ignoreType.
Java (validated pattern)
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.openqa.selenium.JavascriptExecutor;
Map<String, Object> options = new HashMap<>();
options.put("ignoreType", Arrays.asList("layout"));
options.put("screenshotName", "my-layout-screenshot-01");
((JavascriptExecutor) driver).executeScript("smartui.takeScreenshot", options);
Session LT:Options for this flow typically needs at least smartUI.project (and visual, credentials)—not a separate layout capability block for the same effect.
JavaScript
await driver.executeScript('smartui.takeScreenshot', {
screenshotName: 'my-layout-screenshot-01',
ignoreType: ['layout'],
});