From 51328ca8c6d296bee1f6a2d75fac9e3fec8764dd Mon Sep 17 00:00:00 2001 From: Liam Bigelow <40188355+bglw@users.noreply.github.com> Date: Thu, 19 Dec 2024 09:40:51 +1300 Subject: [PATCH] Allow "I click" to click elements with a `role="button"` attribute --- CHANGELOG.md | 2 ++ toolproof/src/definitions/browser/mod.rs | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4deb4e..3257800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ ## Unreleased +* Allow the generic "I click" action to click elements with a `role="button"` attribute + ## v0.10.1 (December 12, 2024) * Made the browser click/hover steps more resilient to DOM nodes detaching mid-action diff --git a/toolproof/src/definitions/browser/mod.rs b/toolproof/src/definitions/browser/mod.rs index 332cd47..976e8af 100644 --- a/toolproof/src/definitions/browser/mod.rs +++ b/toolproof/src/definitions/browser/mod.rs @@ -276,7 +276,13 @@ impl BrowserWindow { let el_xpath = |el: &str| { format!("//{el}[contains(translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), '{text}')]") }; - let xpath = [el_xpath("a"), el_xpath("button"), el_xpath("input")].join(" | "); + let xpath = [ + el_xpath("a"), + el_xpath("button"), + el_xpath("input"), + el_xpath("*[@role='button']"), + ] + .join(" | "); loop { let elements = browser_specific::wait_for_chrome_xpath_selectors(