automation_model 1.0.810-dev → 1.0.812-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.
@@ -508,12 +508,6 @@ class StableBrowser {
508
508
  if (!el.setAttribute) {
509
509
  el = el.parentElement;
510
510
  }
511
- // remove any attributes start with data-blinq-id
512
- // for (let i = 0; i < el.attributes.length; i++) {
513
- // if (el.attributes[i].name.startsWith("data-blinq-id")) {
514
- // el.removeAttribute(el.attributes[i].name);
515
- // }
516
- // }
517
511
  el.setAttribute("data-blinq-id-" + randomToken, "");
518
512
  return true;
519
513
  }, [tag1, randomToken]))) {
@@ -808,16 +802,23 @@ class StableBrowser {
808
802
  element = await this._locate_internal(selectors, info, _params, timeout, allowDisabled);
809
803
  }
810
804
  if (!element.rerun) {
811
- const randomToken = Math.random().toString(36).substring(7);
812
- await element.evaluate((el, randomToken) => {
813
- el.setAttribute("data-blinq-id-" + randomToken, "");
814
- console.log("set data-blinq-id-" + randomToken + " on element", el);
805
+ const randomToken = "blinq_" + Math.random().toString(36).substring(7);
806
+ const id = await element.evaluate((el, randomToken) => {
807
+ // check if the element has id attribute
808
+ if (el.id) {
809
+ return el.id;
810
+ }
811
+ el.setAttribute("id", randomToken);
812
+ console.log("set id=" + randomToken + " on element", el);
813
+ return randomToken;
815
814
  }, randomToken);
816
- // if (element._frame) {
817
- // return element;
818
- // }
819
815
  const scope = element._frame ?? element.page();
820
- let newElementSelector = "[data-blinq-id-" + randomToken + "]";
816
+ let newElementSelector = "#" + id;
817
+ // check if the id contains :
818
+ if (id.includes(":")) {
819
+ // //*[@id="radix-:r0:"]
820
+ newElementSelector = `//*[@id="${id}"]`;
821
+ }
821
822
  let prefixSelector = "";
822
823
  const frameControlSelector = " >> internal:control=enter-frame";
823
824
  const frameSelectorIndex = element._selector.lastIndexOf(frameControlSelector);
@@ -1245,11 +1246,16 @@ class StableBrowser {
1245
1246
  operation: "click",
1246
1247
  log: "***** click on " + selectors.element_name + " *****\n",
1247
1248
  };
1249
+ //profile("click_all ***", this.context, true);
1248
1250
  try {
1251
+ //profile("click_preCommand", this.context, true);
1249
1252
  await _preCommand(state, this);
1253
+ //profile("click_preCommand", this.context, false);
1250
1254
  await performAction("click", state.element, options, this, state, _params);
1251
1255
  if (!this.fastMode) {
1256
+ //profile("click_waitForPageLoad", this.context, true);
1252
1257
  await this.waitForPageLoad({ noSleep: true });
1258
+ //profile("click_waitForPageLoad", this.context, false);
1253
1259
  }
1254
1260
  return state.info;
1255
1261
  }
@@ -1257,7 +1263,10 @@ class StableBrowser {
1257
1263
  await _commandError(state, e, this);
1258
1264
  }
1259
1265
  finally {
1266
+ //profile("click_commandFinally", this.context, true);
1260
1267
  await _commandFinally(state, this);
1268
+ //profile("click_commandFinally", this.context, false);
1269
+ //profile("click_all ***", this.context, false);
1261
1270
  }
1262
1271
  }
1263
1272
  async waitForElement(selectors, _params, options = {}, world = null) {