automation_model 1.0.14 → 1.0.15

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.
@@ -17,7 +17,7 @@ class StableBrowser {
17
17
  async _checkUnique(locator) {
18
18
  let count = await locator.count();
19
19
  if (count > 1) {
20
- logger.error("Found more than one element for locator", JSON.stringify(locator));
20
+ this.logger.error("Found more than one element for locator" + JSON.stringify(locator.toString()));
21
21
  for (let i = 0; i < count; i++) {
22
22
  let loc = locator.nth(i);
23
23
  if ((await loc.isVisible()) && (await loc.isEnabled())) {
@@ -47,17 +47,15 @@ class StableBrowser {
47
47
  if (selector.text) {
48
48
  return await this._checkUnique(scope.getByText(selector.text));
49
49
  }
50
+ } else if (typeof selector === "string" && selector.startsWith("TEXT=")) {
51
+ return await this.page.getByText(selector.substring("TEXT=".length));
52
+ } else {
53
+ return await this.page.locator(selector);
50
54
  }
51
55
  throw new Error(`Unknown locator type ${type}`);
52
56
  } catch (e) {
53
57
  console.log("invalid locator object, will try to parse as text");
54
58
  }
55
-
56
- if (selector.startsWith("TEXT=")) {
57
- return await this.page.getByText(selector.substring("TEXT=".length));
58
- } else {
59
- return await this.page.locator(selector);
60
- }
61
59
  }
62
60
 
63
61
  async click(selector) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automation_model",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "An automation infrastructure module to be use for generative AI automation projects.",
5
5
  "main": "bin/index.js",
6
6
  "type": "module",