Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver): normalize repeated macOS consent labels (#3706)

injaneity4c96f24968ec
diff --git a/libs/cua-driver/rust/crates/platform-macos/src/browser/consent_ui.rs b/libs/cua-driver/rust/crates/platform-macos/src/browser/consent_ui.rs
index ff05feaf12..4d2e131a9a 100644
--- a/libs/cua-driver/rust/crates/platform-macos/src/browser/consent_ui.rs
+++ b/libs/cua-driver/rust/crates/platform-macos/src/browser/consent_ui.rs
@@ -23,7 +23,8 @@ fn refusal(code: BrowserRefusalCode, message: impl Into<String>) -> BrowserRefus
}
fn normalized_text(node: &AXNode) -> String {
- [
+ let mut parts = Vec::new();
+ for text in [
node.title.as_deref(),
node.value.as_deref(),
node.description.as_deref(),
@@ -31,10 +32,13 @@ fn normalized_text(node: &AXNode) -> String {
]
.into_iter()
.flatten()
- .collect::<Vec<_>>()
- .join(" ")
- .trim()
- .to_ascii_lowercase()
+ {
+ let text = text.trim().to_ascii_lowercase();
+ if !text.is_empty() && !parts.contains(&text) {
+ parts.push(text);
+ }
+ }
+ parts.join(" ")
}
fn release_actionable_nodes(nodes: &[AXNode]) {