automation_model 1.0.430-dev → 1.0.430

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.
Files changed (60) hide show
  1. package/README.md +130 -0
  2. package/lib/api.d.ts +43 -1
  3. package/lib/api.js +241 -41
  4. package/lib/api.js.map +1 -1
  5. package/lib/auto_page.d.ts +5 -2
  6. package/lib/auto_page.js +177 -46
  7. package/lib/auto_page.js.map +1 -1
  8. package/lib/browser_manager.d.ts +7 -3
  9. package/lib/browser_manager.js +161 -49
  10. package/lib/browser_manager.js.map +1 -1
  11. package/lib/bruno.d.ts +1 -0
  12. package/lib/bruno.js +301 -0
  13. package/lib/bruno.js.map +1 -0
  14. package/lib/command_common.d.ts +6 -0
  15. package/lib/command_common.js +198 -0
  16. package/lib/command_common.js.map +1 -0
  17. package/lib/environment.d.ts +3 -0
  18. package/lib/environment.js +5 -2
  19. package/lib/environment.js.map +1 -1
  20. package/lib/error-messages.d.ts +6 -0
  21. package/lib/error-messages.js +206 -0
  22. package/lib/error-messages.js.map +1 -0
  23. package/lib/generation_scripts.d.ts +4 -0
  24. package/lib/generation_scripts.js +2 -0
  25. package/lib/generation_scripts.js.map +1 -0
  26. package/lib/index.d.ts +2 -0
  27. package/lib/index.js +2 -0
  28. package/lib/index.js.map +1 -1
  29. package/lib/init_browser.d.ts +5 -2
  30. package/lib/init_browser.js +124 -7
  31. package/lib/init_browser.js.map +1 -1
  32. package/lib/locate_element.d.ts +7 -0
  33. package/lib/locate_element.js +215 -0
  34. package/lib/locate_element.js.map +1 -0
  35. package/lib/locator.d.ts +36 -0
  36. package/lib/locator.js +165 -0
  37. package/lib/locator.js.map +1 -1
  38. package/lib/locator_log.d.ts +26 -0
  39. package/lib/locator_log.js +69 -0
  40. package/lib/locator_log.js.map +1 -0
  41. package/lib/network.d.ts +3 -0
  42. package/lib/network.js +183 -0
  43. package/lib/network.js.map +1 -0
  44. package/lib/scripts/axe.mini.js +12 -0
  45. package/lib/stable_browser.d.ts +104 -36
  46. package/lib/stable_browser.js +1802 -1240
  47. package/lib/stable_browser.js.map +1 -1
  48. package/lib/table.d.ts +13 -0
  49. package/lib/table.js +187 -0
  50. package/lib/table.js.map +1 -0
  51. package/lib/table_helper.d.ts +19 -0
  52. package/lib/table_helper.js +116 -0
  53. package/lib/table_helper.js.map +1 -0
  54. package/lib/test_context.d.ts +6 -0
  55. package/lib/test_context.js +14 -10
  56. package/lib/test_context.js.map +1 -1
  57. package/lib/utils.d.ts +22 -2
  58. package/lib/utils.js +664 -11
  59. package/lib/utils.js.map +1 -1
  60. package/package.json +14 -8
@@ -0,0 +1,206 @@
1
+ function classifyPlaywrightError(error) {
2
+ const errorMessage = error.message.toLowerCase();
3
+ // Timeout Errors
4
+ if (error.name === "TimeoutError" || errorMessage.includes("timeout")) {
5
+ return {
6
+ errorType: "TimeoutError",
7
+ errorMessage: error.message,
8
+ };
9
+ }
10
+ // Network Errors
11
+ if (errorMessage.includes("connect econnrefused") ||
12
+ errorMessage.includes("net::") ||
13
+ errorMessage.includes("network") ||
14
+ errorMessage.includes("connection refused") ||
15
+ errorMessage.includes("failed to fetch")) {
16
+ return {
17
+ errorType: "NetworkError",
18
+ errorMessage: error.message,
19
+ };
20
+ }
21
+ // Selector Errors
22
+ if (errorMessage.includes("no element matches selector") ||
23
+ errorMessage.includes("no node found for selector") ||
24
+ errorMessage.includes("resolved to") ||
25
+ errorMessage.includes("element not found")) {
26
+ return {
27
+ errorType: "SelectorError",
28
+ errorMessage: error.message,
29
+ };
30
+ }
31
+ // Frame Errors
32
+ if (errorMessage.includes("frame was detached") ||
33
+ errorMessage.includes("frame not found") ||
34
+ errorMessage.includes("execution context was destroyed")) {
35
+ return {
36
+ errorType: "FrameError",
37
+ errorMessage: error.message,
38
+ };
39
+ }
40
+ // Element State Errors
41
+ if (errorMessage.includes("element is not clickable") ||
42
+ errorMessage.includes("element is outside of viewport") ||
43
+ errorMessage.includes("element is not visible") ||
44
+ errorMessage.includes("element is disabled")) {
45
+ return {
46
+ errorType: "ElementStateError",
47
+ errorMessage: error.message,
48
+ };
49
+ }
50
+ // Browser Context Errors
51
+ if (errorMessage.includes("target closed") ||
52
+ errorMessage.includes("browser has been closed") ||
53
+ errorMessage.includes("connection closed")) {
54
+ return {
55
+ errorType: "BrowserContextError",
56
+ errorMessage: error.message,
57
+ };
58
+ }
59
+ // Screenshot Errors
60
+ if (errorMessage.includes("failed to save screenshot") ||
61
+ errorMessage.includes("screenshot") ||
62
+ (errorMessage.includes("enoent") && errorMessage.includes("screenshots"))) {
63
+ return {
64
+ errorType: "ScreenshotError",
65
+ errorMessage: error.message,
66
+ };
67
+ }
68
+ // Type Errors
69
+ if (errorMessage.includes("cannot type") ||
70
+ errorMessage.includes("element is not an <input>") ||
71
+ errorMessage.includes("element is not focusable")) {
72
+ return {
73
+ errorType: "TypeError",
74
+ errorMessage: error.message,
75
+ };
76
+ }
77
+ // Evaluation Errors
78
+ if (errorMessage.includes("evaluation failed") ||
79
+ errorMessage.includes("execution context was destroyed") ||
80
+ errorMessage.includes("cannot execute in detached frame")) {
81
+ return {
82
+ errorType: "EvaluationError",
83
+ errorMessage: error.message,
84
+ };
85
+ }
86
+ // Assertion Errors
87
+ if (error.name === "AssertionError" || errorMessage.includes("expect(") || errorMessage.includes("assertion")) {
88
+ return {
89
+ errorType: "AssertionError",
90
+ errorMessage: error.message,
91
+ };
92
+ }
93
+ // Default case for unrecognized errors
94
+ return {
95
+ errorType: "UnknownError",
96
+ errorMessage: error.message,
97
+ };
98
+ }
99
+ function classifyJSError(error) {
100
+ const errorMessage = error.message.toLowerCase();
101
+ // Syntax Errors
102
+ if (error.name === "SyntaxError" || errorMessage.includes("syntax error")) {
103
+ return {
104
+ errorType: "SyntaxError",
105
+ errorMessage: error.message,
106
+ };
107
+ }
108
+ // Reference Errors
109
+ if (error.name === "ReferenceError" || errorMessage.includes("reference error")) {
110
+ return {
111
+ errorType: "ReferenceError",
112
+ errorMessage: error.message,
113
+ };
114
+ }
115
+ // Type Errors
116
+ if (error.name === "TypeError" || errorMessage.includes("type error")) {
117
+ return {
118
+ errorType: "TypeError",
119
+ errorMessage: error.message,
120
+ };
121
+ }
122
+ // Range Errors
123
+ if (error.name === "RangeError" || errorMessage.includes("range error")) {
124
+ return {
125
+ errorType: "RangeError",
126
+ errorMessage: error.message,
127
+ };
128
+ }
129
+ // Default case for unrecognized errors
130
+ return {
131
+ errorType: "UnknownError",
132
+ errorMessage: error.message,
133
+ };
134
+ }
135
+ const classifyErrorFromInfo = (error, info) => {
136
+ const failCause = info?.failCause;
137
+ if (!failCause) {
138
+ return {
139
+ errorType: "UnknownError",
140
+ errorMessage: error.message,
141
+ };
142
+ }
143
+ if (failCause.enabled === false) {
144
+ return {
145
+ errorType: "ElementDisabled",
146
+ errorMessage: failCause.lastError,
147
+ };
148
+ }
149
+ if (failCause.visible === false) {
150
+ return {
151
+ errorType: "ElementNotVisible",
152
+ errorMessage: failCause.lastError,
153
+ };
154
+ }
155
+ if (failCause.textNotFound) {
156
+ return {
157
+ errorType: "TextNotFoundError",
158
+ errorMessage: failCause.lastError,
159
+ };
160
+ }
161
+ if (failCause.iframeNotFound) {
162
+ return {
163
+ errorType: "IframeNotFoundError",
164
+ errorMessage: failCause.lastError,
165
+ };
166
+ }
167
+ if (failCause.locatorNotFound) {
168
+ return {
169
+ errorType: "ElementNotFoundError",
170
+ errorMessage: failCause.lastError,
171
+ };
172
+ }
173
+ if (failCause.foundMultiple) {
174
+ return {
175
+ errorType: "MultipleElementsFoundError",
176
+ errorMessage: failCause.lastError ?? `Found ${failCause.count} elements`,
177
+ };
178
+ }
179
+ if (failCause.assertionFailed) {
180
+ return {
181
+ errorType: "AssertionError",
182
+ errorMessage: failCause.lastError,
183
+ };
184
+ }
185
+ return {
186
+ errorType: "UnknownError",
187
+ errorMessage: error.message,
188
+ };
189
+ };
190
+ const getHumanReadableErrorMessage = (error, info) => {
191
+ // @ts-ignore
192
+ if (error.errors && error.errors.length > 0) {
193
+ // @ts-ignore
194
+ return getHumanReadableErrorMessage(error.errors[0], info);
195
+ }
196
+ let errorClassification = classifyErrorFromInfo(error, info);
197
+ if (errorClassification.errorType === "UnknownError") {
198
+ errorClassification = classifyPlaywrightError(error);
199
+ }
200
+ if (errorClassification.errorType === "UnknownError") {
201
+ errorClassification = classifyJSError(error);
202
+ }
203
+ return errorClassification;
204
+ };
205
+ export { getHumanReadableErrorMessage };
206
+ //# sourceMappingURL=error-messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-messages.js","sourceRoot":"","sources":["../../src/error-messages.ts"],"names":[],"mappings":"AAKA,SAAS,uBAAuB,CAAC,KAAY;IAC3C,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAEjD,iBAAiB;IACjB,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACrE,OAAO;YACL,SAAS,EAAE,cAAc;YACzB,YAAY,EAAE,KAAK,CAAC,OAAO;SAC5B,CAAC;KACH;IAED,iBAAiB;IACjB,IACE,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QAC7C,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC9B,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC;QAChC,YAAY,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAC3C,YAAY,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EACxC;QACA,OAAO;YACL,SAAS,EAAE,cAAc;YACzB,YAAY,EAAE,KAAK,CAAC,OAAO;SAC5B,CAAC;KACH;IAED,kBAAkB;IAClB,IACE,YAAY,CAAC,QAAQ,CAAC,6BAA6B,CAAC;QACpD,YAAY,CAAC,QAAQ,CAAC,4BAA4B,CAAC;QACnD,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAC;QACpC,YAAY,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAC1C;QACA,OAAO;YACL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@@ -0,0 +1,4 @@
1
+ export interface InitScripts {
2
+ recorderCjs: string | null;
3
+ scripts: string[] | null;
4
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generation_scripts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generation_scripts.js","sourceRoot":"","sources":["../../src/generation_scripts.ts"],"names":[],"mappings":""}
package/lib/index.d.ts CHANGED
@@ -7,3 +7,5 @@ export * from "./browser_manager.js";
7
7
  export * from "./analyze_helper.js";
8
8
  export * from "./find_function.js";
9
9
  export * from "./utils.js";
10
+ export * from "./table.js";
11
+ export * from "./bruno.js";
package/lib/index.js CHANGED
@@ -7,4 +7,6 @@ export * from "./browser_manager.js";
7
7
  export * from "./analyze_helper.js";
8
8
  export * from "./find_function.js";
9
9
  export * from "./utils.js";
10
+ export * from "./table.js";
11
+ export * from "./bruno.js";
10
12
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
@@ -1,7 +1,10 @@
1
1
  import { Environment } from "./environment.js";
2
2
  import { TestContext } from "./test_context.js";
3
+ import { StableBrowser } from "./stable_browser.js";
3
4
  import { Browser as PlaywrightBrowser } from "playwright";
4
5
  import { Browser } from "./browser_manager.js";
5
- declare const getContext: (environment: Environment | null, headless?: boolean, logger?: null) => Promise<TestContext>;
6
+ import { InitScripts } from "./generation_scripts.js";
7
+ declare const getContext: (environment: Environment | null, headless: boolean | undefined, world: any, logger?: null, appName?: string | null, createStable?: boolean, web?: StableBrowser | null, moveToRight?: number, reportFolder?: string | null, initScripts?: InitScripts | null, storageState?: any | null) => Promise<TestContext>;
8
+ declare const refreshBrowser: (web: any, sessionPath: string, world: any) => Promise<void>;
6
9
  declare const closeBrowser: (browser?: Browser | PlaywrightBrowser) => Promise<void>;
7
- export { getContext, closeBrowser };
10
+ export { getContext, closeBrowser, refreshBrowser };
@@ -7,10 +7,16 @@ import { StableBrowser } from "./stable_browser.js";
7
7
  import { Api } from "./api.js";
8
8
  // let environment = null;
9
9
  // init browser create context and page, if context and page are not null
10
- const getContext = async function (environment, headless = false, logger) {
10
+ const getContext = async function (environment, headless = false, world, logger, appName, createStable = true, web = null, moveToRight = -1, reportFolder = null, initScripts = null, storageState = null) {
11
11
  if (environment === null) {
12
12
  environment = initEnvironment();
13
13
  }
14
+ if (appName && !environment.apps && !environment.apps[appName]) {
15
+ throw new Error(`App ${appName} not found in environment`);
16
+ }
17
+ if (appName) {
18
+ environment = environment.apps[appName];
19
+ }
14
20
  const { cookies, origins } = environment;
15
21
  if (cookies) {
16
22
  for (let i = 0; i < cookies.length; i++) {
@@ -22,31 +28,139 @@ const getContext = async function (environment, headless = false, logger) {
22
28
  }
23
29
  let extensionPath = undefined;
24
30
  let userDataDirPath = undefined;
31
+ let userAgent = undefined;
25
32
  let aiConfigFile = "ai_config.json";
33
+ let channel = undefined;
26
34
  if (process.env.PROJECT_PATH) {
27
35
  aiConfigFile = path.join(process.env.PROJECT_PATH, "ai_config.json");
28
36
  }
37
+ let configuration = {};
29
38
  if (fs.existsSync(aiConfigFile)) {
30
- const configuration = JSON.parse(fs.readFileSync(aiConfigFile, "utf8"));
39
+ configuration = JSON.parse(fs.readFileSync(aiConfigFile, "utf8"));
31
40
  if (configuration.userDataDirPath) {
32
41
  userDataDirPath = configuration.userDataDirPath;
33
42
  }
34
43
  if (configuration.extensionPath) {
35
44
  extensionPath = configuration.extensionPath;
36
45
  }
46
+ if (configuration.useGoogleChrome === true) {
47
+ channel = "chrome";
48
+ }
49
+ else if (configuration.useMicrosoftEdge === true) {
50
+ channel = "msedge";
51
+ }
52
+ if (configuration.overrideUserAgent) {
53
+ userAgent = configuration.overrideUserAgent;
54
+ }
55
+ }
56
+ let usedStorageState = null;
57
+ usedStorageState = { cookies, origins };
58
+ let downloadsPath = "downloads";
59
+ if (reportFolder) {
60
+ downloadsPath = path.join(reportFolder, "downloads");
37
61
  }
38
- const storageState = { cookies, origins };
39
- let browser = await browserManager.getBrowser(headless, storageState, extensionPath, userDataDirPath);
62
+ else if (web && web.context && web.context.reportFolder) {
63
+ reportFolder = web.context.reportFolder;
64
+ downloadsPath = path.join(web.context.reportFolder, "downloads");
65
+ }
66
+ if (world) {
67
+ world.downloadsPath = downloadsPath;
68
+ }
69
+ if (web && web.context) {
70
+ web.context.downloadsPath = downloadsPath;
71
+ }
72
+ // check if data.json exists in the report folder
73
+ // and if it contain storageState field, if so, use it
74
+ if (reportFolder) {
75
+ const dataFile = path.join(reportFolder, "data.json");
76
+ if (fs.existsSync(dataFile)) {
77
+ const data = fs.readFileSync(dataFile, "utf8");
78
+ const dataObject = JSON.parse(data);
79
+ if (dataObject.storageState) {
80
+ console.log("Init browser with storage state");
81
+ usedStorageState = dataObject.storageState;
82
+ }
83
+ }
84
+ }
85
+ if (storageState) {
86
+ usedStorageState = storageState;
87
+ }
88
+ let browser = await browserManager.createBrowser(headless, usedStorageState, extensionPath, userDataDirPath, reportFolder ? reportFolder : ".", userAgent, channel, configuration, initScripts);
40
89
  let context = new TestContext();
41
90
  context.browser = browser.browser;
91
+ context.browserObject = browser;
42
92
  context.playContext = browser.context;
43
93
  context.page = browser.page;
94
+ context.headless = headless;
44
95
  context.environment = environment;
45
- context.stable = new StableBrowser(context.browser, context.page, logger, context);
96
+ context.browserName = browser.browser ? browser.browser.browserType().name() : "unknown";
97
+ context.reportFolder = reportFolder;
98
+ context.initScripts = initScripts;
99
+ if (process.env.CDP_CONNECT_URL) {
100
+ // settin it to true will not navigate
101
+ context.navigate = true;
102
+ }
103
+ if (createStable) {
104
+ context.stable = new StableBrowser(context.browser, context.page, logger, context, world);
105
+ context.web = context.stable;
106
+ }
107
+ else {
108
+ context.stable = web;
109
+ context.web = web;
110
+ }
46
111
  context.api = new Api(logger);
112
+ if (moveToRight > 0 && context.browserName === "chromium") {
113
+ // move the borwser to the top right corner of the screen
114
+ // create a cdp session
115
+ // Get CDP session
116
+ const playContext = context.playContext;
117
+ const client = await playContext.newCDPSession(context.page);
118
+ // Get window ID for the current target
119
+ const { windowId } = await client.send("Browser.getWindowForTarget");
120
+ //console.log(windowId);
121
+ // get the window for the current target
122
+ const window = await client.send("Browser.getWindowBounds", {
123
+ windowId,
124
+ });
125
+ //console.log(window);
126
+ await client.send("Browser.setWindowBounds", {
127
+ windowId,
128
+ bounds: {
129
+ left: window.bounds.left + moveToRight,
130
+ },
131
+ });
132
+ // close cdp
133
+ await client.detach();
134
+ }
47
135
  // await _initCookies(context);
48
136
  return context;
49
137
  };
138
+ const refreshBrowser = async function (web, sessionPath, world) {
139
+ await web.context.browserObject.close();
140
+ web.context.pages = [];
141
+ let storageState = null;
142
+ if (sessionPath) {
143
+ if (!fs.existsSync(sessionPath)) {
144
+ throw new Error("Session path not found: " + sessionPath);
145
+ }
146
+ const data = fs.readFileSync(sessionPath, "utf8");
147
+ storageState = JSON.parse(data).storageState;
148
+ }
149
+ const newContext = await getContext(web.context.environment, web.context.headless, world, null, web.context.appName, false, web, -1, web.context.reportFolder, web.context.initScripts, storageState);
150
+ // clone all the new context properties to the old context
151
+ web.context.browser = newContext.browser;
152
+ web.context.browserObject = newContext.browserObject;
153
+ web.context.playContext = newContext.playContext;
154
+ web.context.page = newContext.page;
155
+ web.page = newContext.page;
156
+ web.context.pages.push(newContext.page);
157
+ web.context.headless = newContext.headless;
158
+ web.context.environment = newContext.environment;
159
+ web.context.browserName = newContext.browserName;
160
+ web.context.reportFolder = newContext.reportFolder;
161
+ web.context.initScripts = newContext.initScripts;
162
+ await web.goto(web.context.environment.baseUrl);
163
+ };
50
164
  const closeBrowser = async function (browser) {
51
165
  await browserManager.closeBrowser(browser);
52
166
  };
@@ -75,7 +189,10 @@ const initEnvironment = function () {
75
189
  }
76
190
  }
77
191
  }
78
- // console.log("envFile: ", envFile);
192
+ // check if the envFile is not empty and exists
193
+ if (!envFile || !fs.existsSync(envFile)) {
194
+ throw new Error(envFile + " not found");
195
+ }
79
196
  const data = fs.readFileSync(envFile, "utf8");
80
197
  //console.log("data", data);
81
198
  const envObject = JSON.parse(data);
@@ -101,5 +218,5 @@ const checkForEnvArg = function () {
101
218
  }
102
219
  return null;
103
220
  };
104
- export { getContext, closeBrowser };
221
+ export { getContext, closeBrowser, refreshBrowser };
105
222
  //# sourceMappingURL=init_browser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init_browser.js","sourceRoot":"","sources":["../../src/init_browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,0BAA0B;A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AAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,YAAY,CAAC,CAAC;SACzC;QACD,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9C,4BAA4B;QAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,sCAAsC;QACtC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACtC,kCAAkC;QAClC,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;KACjD;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;KAC9C;IACD,IAAI;IACJ,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AACF,MAAM,cAAc,GAAG;IACrB,KAAK,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACrC,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACxB,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE;gBAC1B,OAAO,KAAK,CAAC;aACd;SACF;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AACF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function locate_element(context: any, elementDescription: string, operation?: string, value?: string | null): Promise<{
2
+ reason: any;
3
+ elementNumber: any;
4
+ frameIndex: number;
5
+ frame: null;
6
+ css: string;
7
+ } | null>;