Skip to content

added default value and optimized xpath#140

Merged
sauravpanda merged 2 commits intomainfrom
139-add-ai-strategy-selection
Nov 14, 2025
Merged

added default value and optimized xpath#140
sauravpanda merged 2 commits intomainfrom
139-add-ai-strategy-selection

Conversation

@sauravpanda
Copy link
Copy Markdown
Collaborator

@sauravpanda sauravpanda commented Nov 14, 2025

Summary by cubic

Adds default values for workflow inputs and prioritizes XPath-based selectorStrategies for clicks to improve reliability and meet 139-add-ai-strategy-selection. Prompts now show and use defaults, and clicking uses evaluated XPath when provided, with semantic strategies supported via the selector map.

  • New Features

    • Support default values in WorkflowInputSchemaDefinition; CLI shows and uses defaults.
    • Prioritize step.selectorStrategies; XPath clicks executed via JS evaluation (more reliable).
    • Added XPath optimizer to generate robust alternatives from absolute XPaths.
    • Optional target_text validation with clear errors when strategies fail.
  • Refactors

    • ElementFinder executes XPath via page.evaluate and supports semantic strategies via selector_map.
    • Text-first click no longer blocks when a selector exists; falls back with warnings.
    • Minor typing cleanups; bumped workflow-use to 0.2.9.

Written for commit 3dcf69f. Summary will update automatically on new commits.

@sauravpanda sauravpanda linked an issue Nov 14, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 11 files

Prompt for AI agents (all 3 issues)

Understand the root cause of the following 3 issues and fix them.


<file name="workflows/workflow_use/workflow/element_finder.py">

<violation number="1" location="workflows/workflow_use/workflow/element_finder.py:99">
Returning a hard-coded index of 0 breaks both callers—service.py will click the wrong element and semantic_executor.py will raise because it expects a selector string.</violation>

<violation number="2" location="workflows/workflow_use/workflow/element_finder.py:107">
By short-circuiting with “Strategy type … not yet supported”, every non-XPath strategy (text_exact, role_text, aria_label, etc.) now always fails, even though the selector generator and existing tests still rely on them. This regresses the core semantic matching behavior.</violation>
</file>

<file name="workflows/workflow_use/healing/xpath_optimizer.py">

<violation number="1" location="workflows/workflow_use/healing/xpath_optimizer.py:138">
Dynamic attribute and text values need escaping before embedding in XPath literals; otherwise any single quote in the value produces an invalid selector.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

Comment thread workflows/workflow_use/workflow/element_finder.py Outdated
Comment thread workflows/workflow_use/workflow/element_finder.py Outdated
Comment thread workflows/workflow_use/healing/xpath_optimizer.py Outdated
@sauravpanda sauravpanda merged commit 680f5d3 into main Nov 14, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add ai strategy selection

1 participant