Skip to content

Commit

Permalink
fix: fix selector validation if it contains data-attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Iogsotot committed May 17, 2024
1 parent 1d73e0e commit 2d69328
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pageServices/contentScripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export const evaluateStandardLocator = ({
foundElements = document.querySelectorAll(preparedClassName);
} else if (locatorType.startsWith('data-')) {
foundElements = document.querySelectorAll(`[${locatorType}="${selector}"]`);
} else if (selector.startsWith('[data-') && locatorType === LocatorType.cssSelector) {
// TODO: find where added escaping for this string and remove it:
// At the moment the workaround replaceAll(/\\/g, '') is used
foundElements = document.querySelectorAll(`${selector.replaceAll(/\\/g, '')}`);
} else {
foundElements = document.querySelectorAll(selector);
}
Expand Down

0 comments on commit 2d69328

Please sign in to comment.