automation_model 1.0.5 → 1.0.6

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.
@@ -10,33 +10,33 @@ class StableBrowser {
10
10
  });
11
11
  }
12
12
  async _locate(selector, scope) {
13
- if (typeof selector === "object") {
14
- try {
15
- if (Array.isArray(selector)) {
16
- let currentScope = scope;
13
+ try {
14
+ if (Array.isArray(selector)) {
15
+ let currentScope = scope;
17
16
 
18
- for (let i = 0; i < selector.length; i++) {
19
- currentScope = await this._locate(
20
- selector[i],
21
- currentScope
22
- ).first();
23
- }
17
+ for (let i = 0; i < selector.length; i++) {
18
+ currentScope = (
19
+ await this._locate(selector[i], currentScope)
20
+ ).first();
24
21
  }
22
+ return currentScope;
23
+ }
24
+ if (typeof selector === "object") {
25
25
  if (selector.css) {
26
- return await scope.locator(selector.css).first();
26
+ return (await scope.locator(selector.css)).first();
27
27
  }
28
28
  if (selector.role) {
29
- return await scope
30
- .getByRole(selector.role[0], selector.role[1])
31
- .first();
29
+ return (
30
+ await scope.getByRole(selector.role[0], selector.role[1])
31
+ ).first();
32
32
  }
33
33
  if (selector.text) {
34
- return await scope.getByText(selector.text).first();
34
+ return await scope.getByText(selector.text);
35
35
  }
36
- throw new Error(`Unknown locator type ${type}`);
37
- } catch (e) {
38
- console.log("invalid locator object, will try to parse as text");
39
36
  }
37
+ throw new Error(`Unknown locator type ${type}`);
38
+ } catch (e) {
39
+ console.log("invalid locator object, will try to parse as text");
40
40
  }
41
41
 
42
42
  if (selector.startsWith("TEXT=")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automation_model",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
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",