Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,20 @@ fn parse_find(rest: &[&str], id: &str) -> Result<Value, ParseError> {
},
})?;
let subaction = rest.get(2).unwrap_or(&"click");

// Detect position modifiers (first/last/nth) used after a locator type
// e.g., "find role spinbutton first fill '20'" — "first" is in the subaction slot
if matches!(*subaction, "first" | "last" | "nth") && !matches!(*locator, "first" | "last" | "nth") {
return Err(ParseError::InvalidValue {
message: format!(
"\"{}\" cannot be used as a modifier after \"{}\". \
Use it as the primary locator: find {} <selector> [action] [text]",
Copy link
Contributor

Choose a reason for hiding this comment

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

Error message and usage hint are incorrect when nth is misused as a position modifier after a locator type (e.g., find role spinbutton nth).

Fix on Vercel

subaction, locator, subaction
),
usage: "find first <selector> [action] [text]",
});
}

let fill_value = if rest.len() > 3 {
Some(rest[3..].join(" "))
} else {
Expand Down