Skip to content

Commit

Permalink
Merge pull request #12 from CloudCannon/feat/click-role-button
Browse files Browse the repository at this point in the history
Allow "I click" to click elements with a `role="button"` attribute
  • Loading branch information
bglw authored Dec 18, 2024
2 parents 44837e5 + 51328ca commit 12bf4f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion toolproof/src/definitions/browser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 12bf4f2

Please sign in to comment.