Skip to content

Commit

Permalink
Make the failSilently directive work per-element
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhall committed Jan 31, 2025
1 parent 125c9af commit b3ba0fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"action": {
"actionType": "click",
"id": "1",
"failSilently": true,
"elements": [
{
"type": "button",
"selector": ".btn"
"selector": ".btn",
"failSilently": true
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"action": {
"actionType": "click",
"id": "1",
"failSilently": true,
"elements": [
{
"type": "button",
"selector": ".test"
"selector": ".test",
"failSilently": true
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions injected/src/features/broker-protection/actions/click.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function click(action, userData, root = document) {
const elements = getElements(rootElement, element.selector);

if (!elements?.length) {
if (action.failSilently) {
if (element.failSilently) {
return new SuccessResponse({ actionID: action.id, actionType: action.actionType, response: null });
}

Expand All @@ -67,7 +67,7 @@ export function click(action, userData, root = document) {
const elem = elements[i];

if ('disabled' in elem) {
if (elem.disabled && !action.failSilently) {
if (elem.disabled && !element.failSilently) {
return new ErrorResponse({ actionID: action.id, message: `could not click disabled element ${element.selector}'!` });
}
}
Expand Down

0 comments on commit b3ba0fa

Please sign in to comment.