automation_model 1.0.840-dev → 1.0.842-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/file_checker.js.map +1 -1
- package/lib/locator_log.js.map +1 -1
- package/lib/scripts/axe.mini.js +23994 -1
- package/lib/stable_browser.js +22 -13
- package/lib/stable_browser.js.map +1 -1
- package/package.json +1 -1
package/lib/stable_browser.js
CHANGED
|
@@ -843,20 +843,29 @@ class StableBrowser {
|
|
|
843
843
|
}
|
|
844
844
|
else {
|
|
845
845
|
const randomToken = "blinq_" + Math.random().toString(36).substring(7);
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
846
|
+
if (this.configuration && this.configuration.stableLocatorStrategy === "data-attribute") {
|
|
847
|
+
const dataAttribute = "data-blinq-id";
|
|
848
|
+
await element.evaluate((el, [dataAttribute, randomToken]) => {
|
|
849
|
+
el.setAttribute(dataAttribute, randomToken);
|
|
850
|
+
}, [dataAttribute, randomToken]);
|
|
851
|
+
newElementSelector = `[${dataAttribute}="${randomToken}"]`;
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
const id = await element.evaluate((el, randomToken) => {
|
|
855
|
+
// check if the element has id attribute
|
|
856
|
+
if (el.id) {
|
|
857
|
+
return el.id;
|
|
858
|
+
}
|
|
859
|
+
el.setAttribute("id", randomToken);
|
|
860
|
+
console.log("set id=" + randomToken + " on element", el);
|
|
861
|
+
return randomToken;
|
|
862
|
+
}, randomToken);
|
|
863
|
+
newElementSelector = "#" + id;
|
|
864
|
+
// check if the id contains :
|
|
865
|
+
if (id.includes(":") || id.includes(".") || id.includes("[") || id.includes("]")) {
|
|
866
|
+
// //*[@id="radix-:r0:"]
|
|
867
|
+
newElementSelector = `//*[@id="${id}"]`;
|
|
850
868
|
}
|
|
851
|
-
el.setAttribute("id", randomToken);
|
|
852
|
-
console.log("set id=" + randomToken + " on element", el);
|
|
853
|
-
return randomToken;
|
|
854
|
-
}, randomToken);
|
|
855
|
-
newElementSelector = "#" + id;
|
|
856
|
-
// check if the id contains :
|
|
857
|
-
if (id.includes(":") || id.includes(".") || id.includes("[") || id.includes("]")) {
|
|
858
|
-
// //*[@id="radix-:r0:"]
|
|
859
|
-
newElementSelector = `//*[@id="${id}"]`;
|
|
860
869
|
}
|
|
861
870
|
}
|
|
862
871
|
const scope = element._frame ?? element.page();
|