QANode Logo

Smart Locators Node

The Smart Locators node allows you to automate interactions with web pages using Playwright's semantic locators — based on ARIA roles, labels, placeholders, and other accessibility attributes. This approach is more resilient than CSS selectors, as it reflects how users actually find elements on the page.

Tip: If you prefer traditional CSS selectors and XPath, use the Web Flow node.


Overview

PropertyValue
Typesmart-locators
CategoryWeb
ColorBlue (#3b82f6)
Inputin
Outputout

General Configuration

Identical to the Web Flow node:

FieldTypeDefaultDescription
Session Modenew / reusenewNew session or reuse an existing one
Session IDstringSession ID to reuse
HeadlessbooleantrueRun without a visible graphical interface
Storage StrategyinMemory / persistedinMemoryPersist cookies/localStorage
Storage KeystringIdentifier for the persisted storage
Browserchromium / firefox / webkitchromiumBrowser to use for the execution
Devicedesktop / mobiledesktopEmulation mode
Viewportpreset or custom1920x1080Window size (Desktop mode)
Width / HeightnumberCustom dimensions (when custom)
Device ModelstringiPhone 14Device to emulate (Mobile mode)

The Browser & Device options are identical to the Web Flow node — see the Web Flow documentation for details on viewport presets and available mobile devices.


Locator System

Location Methods

Instead of CSS selectors, Smart Locators uses Playwright's semantic methods:

MethodDescriptionExample
getByRoleLocates by ARIA roleButton "Sign In", Link "Home"
getByTextLocates by visible textText "Welcome"
getByLabelLocates by associated labelField with label "Email"
getByPlaceholderLocates by placeholderField with placeholder "Enter your name"
getByAltTextLocates by alt textImage with alt "Logo"
getByTitleLocates by titleElement with title "Close"
getByTestIdLocates by data-testiddata-testid="submit-btn"

Locator Configuration

FieldTypeDescription
MethodstringLocation method
ValuestringText/value to search for
NamestringRole name (only for getByRole)
ExactbooleanExact match (false = contains)
NthnumberElement index (when there are multiple)

Available ARIA Roles

For the getByRole method, the following roles are available:

Interaction RolesStructure RolesFeedback Roles
buttonheadingalert
checkboxlistalertdialog
comboboxlistitemdialog
linknavigationprogressbar
listboxregionstatus
menurowtooltip
menuitemcell
optiongrid
radiotab
searchboxtablist
slidertabpanel
spinbuttontoolbar
switchtree
textboxtreeitem

Usage example:

Method: getByRole
Value: button
Name: Sign In

Equivalent in Playwright: page.getByRole('button', { name: 'Sign In' })


Available Actions

ActionColorDescription
navigateBlueNavigate to URL
clickYellowClick on element
dblclickYellowDouble click
fillGreenFill field (instant)
typeGreenType character by character
checkGreenCheck checkbox/radio
uncheckGreenUncheck checkbox
selectOptionPurpleSelect dropdown option
hoverCyanHover mouse over element
focusLight BlueFocus on element
pressGreenPress a key
assertRedVerify condition
extractCyanExtract data
waitPurpleWait for condition
scrollYellowScroll page
refreshOrangeReload page
frameGraySwitch frame
rightClickYellowRight-click
uploadBlueUpload files
dialogPurpleHandle dialogs (alert/confirm)
dragDropBlueDrag and drop
evaluateWhiteExecute JavaScript on the page
screenshotBlueCapture screenshot

Action Details

navigate

Navigates to a URL.

FieldTypeDescription
URLstringDestination URL (supports {{ }})

click

Clicks on a semantically located element.

FieldTypeDescription
LocatorlocatorLocator configuration
RetriesnumberNumber of attempts (default: 3)

The click waits for the element to be visible, scrolls to it if necessary, and then clicks. If it fails, it retries.

Example:

Method: getByRole
Value: button
Name: Submit
Retries: 3

dblclick

Double-clicks on an element.

FieldTypeDescription
LocatorlocatorLocator configuration
RetriesnumberNumber of attempts

fill

Fills an input field instantly (replaces the value).

FieldTypeDescription
LocatorlocatorLocator configuration
TextstringText to fill (supports {{ }})
Clear FirstbooleanClears the field first

Uses Playwright's locator.fill() — ideal for simple fields.


type

Types text character by character, simulating real typing.

FieldTypeDescription
LocatorlocatorLocator configuration
TextstringText to type
Delay (ms)numberInterval between keys (default: 50ms)
Clear FirstbooleanClears the field first

Uses Playwright's locator.pressSequentially() — ideal for fields with:

  • Autocomplete (suggestions appear as you type)
  • Input masks (phone numbers, zip codes)
  • On-keypress validation (validates each key)

Example:

Locator: getByPlaceholder → "Phone"
Text: 123.456.789-00
Delay: 100ms

check / uncheck

Checks or unchecks a checkbox/radio button.

FieldTypeDescription
LocatorlocatorLocator configuration

Example:

Method: getByLabel
Value: I accept the terms of use

selectOption

Selects an option from a dropdown (<select>).

FieldTypeDescription
LocatorlocatorDropdown configuration
Select Bystringvalue, label, or index
ValuestringCorresponding value

hover

Hovers the mouse over an element.

FieldTypeDescription
LocatorlocatorLocator configuration
RetriesnumberNumber of attempts
Wait After (ms)numberWait time after hover

focus

Sets focus on an element.

FieldTypeDescription
LocatorlocatorLocator configuration

press

Presses a keyboard key in the context of an element.

FieldTypeDescription
LocatorlocatorElement that will receive the key
KeystringKey name (Enter, Tab, Escape, etc.)
Wait After (ms)numberWait time after pressing

assert

Verifies conditions on the page. Offers multiple verification modes:

FieldTypeDescription
NamestringAssertion identifier
LocatorlocatorTarget element (when applicable)
ModestringVerification type
Expected TextstringExpected value
Continue on FailurebooleanDo not fail the entire node

Assert Modes:

ModeDescriptionRequires Locator
visibleElement is visibleYes
hiddenElement is hiddenYes
textContainsText contains valueYes
textEqualsText is exactly the valueYes
hasCountElement countYes
enabledElement is enabledYes
disabledElement is disabledYes
checkedCheckbox/radio is checkedYes
hasValueInput has specific valueYes
hasAttributeElement has attribute with valueYes
hasURLPage URL contains/equalsNo
hasTitlePage title contains/equalsNo

Examples:

// Verify that the "Submit" button is visible
Mode: visible, Locator: getByRole("button", "Submit")

// Verify that message contains "Success"
Mode: textContains, Locator: getByText("Success"), Expected: "Success"

// Verify URL after login
Mode: hasURL, Expected: "/dashboard"

// Verify that field is disabled
Mode: disabled, Locator: getByLabel("Email")

extract

Extracts data from an element.

FieldTypeDescription
NamestringExtraction name
LocatorlocatorLocator configuration
AttributestringWhat to extract

Available attributes:

AttributeDescription
textVisible text (textContent)
innerTextInner text
innerHTMLInner HTML
inputValueInput field value
hrefURL of links
srcURL of images
valueGeneric value

wait

Waits for a condition.

ModeDescription
timeoutWaits for a fixed time
visibleWaits for element to become visible
hiddenWaits for element to disappear
networkIdleWaits for network requests to finish

scroll

Scrolls the page.

ModeDescription
toLocatorScrolls to the element
byScrolls a fixed number of pixels
toBottomScrolls to the bottom of the page

refresh

Reloads the page. Same configuration as Web Flow.


frame

Switches to an iframe. Supports name and main modes (return to main context).


Evidence (Screenshots per Step)

Identical to Web Flow — each step can have individual screenshot capture configuration.


Accessibility Testing

Smart Locators supports automatic accessibility scanning with built-in axe-core. When enabled, the node audits the page after each step that captures a screenshot, identifying WCAG/ARIA violations and visually marking the affected elements.

Smart Locators already uses semantic locators based on ARIA roles — combining it with accessibility scanning is especially useful for verifying that the elements you interact with pass accessibility criteria.

Configuration

FieldTypeDefaultDescription
Accessibility ScanbooleanfalseEnables axe-core scanning
Fail When Severity >=none / minor / moderate / serious / criticalseriousMinimum severity level that fails the node

How It Works

After each step that takes a screenshot, axe-core is injected into the page and scans the document for violations. Violations are drawn over the screenshot as colored boxes around the affected elements, plus a summary panel in the corner:

SeverityColorDescription
Critical🔴 RedBlocks access for users with disabilities
Serious🟠 OrangeCauses significant difficulty
Moderate🟡 YellowCauses some difficulty
Minor🔵 BlueRecommended improvement

At the end of execution, the following are generated automatically:

  • Per-step screenshots — overlay with colored boxes + panel Critical N / Serious N / Moderate N / Minor N + top 2 rules
  • Severity chart{id}-accessibility-severity-chart.png — distribution by level
  • Rules chart{id}-accessibility-rule-chart.png — top 8 most violated rules
  • JSON report{id}-accessibility-report.json — full data for all violations

Pass/Fail Criteria

The node fails if there is any violation with severity equal to or above the configured threshold. Use none to never fail (collect metrics without blocking the flow).

Example: Verify login form accessibility

Node configuration:
  Accessibility Scan: true
  Fail When Severity >= : serious

Steps:
1. navigate → https://mysite.com/login            (no screenshot = no scan)
2. fill → getByLabel("Email") → "..."              → screenshot after → scan executed
3. fill → getByLabel("Password") → "..."           → screenshot after → scan executed
4. click → getByRole("button", { name: "Sign In" }) → screenshot after → scan executed
5. wait → networkIdle
6. assert → "loginOk" → textContains → getByText("Welcome") → screenshot → scan executed

If any step has a serious or critical violation, the node fails with:

"Accessibility findings at or above "serious" were detected."


Outputs

OutputTypeDescription
sessionIdstringBrowser session ID
extractsobjectExtracted data (key → value)
assertsobjectAssertion results (key → boolean)
accessibilityPassedbooleanWhether it passed the severity criteria (when enabled)
accessibilityViolationCountnumberTotal violation instances found
accessibilityobjectFull accessibility report
accessibility.thresholdstringConfigured threshold
accessibility.scanCountnumberNumber of checkpoints scanned
accessibility.countsobject{ minor, moderate, serious, critical } — aggregated totals
accessibility.stepsarrayPer-checkpoint details (url, counts, topRules)
accessibility.rulesarrayTop 10 violated rules across the entire flow

Complete Example: Login with Smart Locators

Step 1: navigate → https://mysite.com/login
Step 2: fill → getByLabel("Email") → "{{ variables.EMAIL }}"
Step 3: fill → getByLabel("Password") → "{{ variables.PASSWORD }}"
Step 4: click → getByRole("button", { name: "Sign In" })
Step 5: wait → networkIdle
Step 6: assert → "loginOk" → textContains → getByText("Welcome")
Step 7: extract → "userName" → getByRole("heading") → text

When to Use Smart Locators vs Web Flow

ScenarioRecommendation
Site with good accessibility practicesSmart Locators
Site with data-testid on all elementsWeb Flow
Forms with labelsSmart Locators
Elements without text or roleWeb Flow (CSS/XPath)
Accessibility testingSmart Locators
Legacy / sites without semanticsWeb Flow

Tips

  • Prefer getByRole — it is the most resilient and reflects how assistive technologies find elements
  • Use getByLabel for form fields — it is more stable than CSS
  • getByTestId is great for elements without a clear role/label
  • Use the type action (instead of fill) for fields with masks or autocomplete
  • The Nth field allows you to select a specific element when multiple ones match the locator