donobu 2.14.1 → 2.15.0

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.
@@ -1 +1 @@
1
- 1105
1
+ 1107
@@ -32,7 +32,7 @@
32
32
  return `'${value}'`;
33
33
  }
34
34
 
35
- // If the string has single quotes but no double quotes, wrap in double quotes
35
+ // If the string has no double quotes, wrap in double quotes
36
36
  if (!value.includes('"')) {
37
37
  return `"${value}"`;
38
38
  }
@@ -91,9 +91,24 @@
91
91
  selectors.add(selector),
92
92
  );
93
93
 
94
+ // Generate DOM position-based selectors
95
+ this.getDOMPositionSelectors().forEach((selector) =>
96
+ selectors.add(selector),
97
+ );
98
+
94
99
  // Combine selectors for robustness
95
100
  this.getCombinedSelector().forEach((selector) => selectors.add(selector));
96
101
 
102
+ function selectorTiebreakerPriority(sel) {
103
+ // highest-to-lowest: aria-label, placeholder, text-based XPath, DOM position, id, other
104
+ if (/\[aria-label\s*=/.test(sel) || /@aria-label/.test(sel)) return 0;
105
+ if (/\[placeholder\s*=/.test(sel) || /@placeholder/.test(sel)) return 1;
106
+ if (sel.startsWith('//')) return 2;
107
+ if (sel.includes(' > ')) return 3; // DOM position selector
108
+ if (/^#/.test(sel)) return 4;
109
+ return 5;
110
+ }
111
+
97
112
  const rankedSelectors = Array.from(selectors)
98
113
  .map((selector) => {
99
114
  try {
@@ -104,9 +119,18 @@
104
119
  }
105
120
  })
106
121
  .filter((a) => a !== null && a.count !== 0)
107
- .sort((a, b) => a.count - b.count);
122
+ .sort((a, b) => {
123
+ // 1. fewer matches -> better
124
+ if (a.count !== b.count) return a.count - b.count;
125
+ // 2. tie-break on priority class
126
+ return (
127
+ selectorTiebreakerPriority(a.selector) -
128
+ selectorTiebreakerPriority(b.selector)
129
+ );
130
+ })
131
+ .map((a) => a.selector);
108
132
 
109
- return rankedSelectors.map((a) => a.selector);
133
+ return rankedSelectors;
110
134
  }
111
135
 
112
136
  getIdSelector() {
@@ -243,6 +267,40 @@
243
267
  return [];
244
268
  }
245
269
 
270
+ getDOMPositionSelectors() {
271
+ const selectors = [];
272
+
273
+ // Generate full DOM position-based selector without depth limit
274
+ let currentElement = this.element;
275
+ let path = [];
276
+
277
+ // Build the complete path from the element up to html
278
+ while (currentElement && currentElement !== document) {
279
+ let tagName = currentElement.tagName.toLowerCase();
280
+ const parent = currentElement.parentElement;
281
+
282
+ if (parent) {
283
+ const siblings = Array.from(parent.children).filter(
284
+ (child) => child.tagName.toLowerCase() === tagName,
285
+ );
286
+ if (siblings.length > 1) {
287
+ const index = siblings.indexOf(currentElement) + 1;
288
+ tagName += `:nth-of-type(${index})`;
289
+ }
290
+ }
291
+
292
+ path.unshift(tagName);
293
+ currentElement = currentElement.parentElement;
294
+ }
295
+
296
+ // Create the full selector string with ">" separators
297
+ if (path.length > 1) {
298
+ selectors.push(path.join(' > '));
299
+ }
300
+
301
+ return selectors;
302
+ }
303
+
246
304
  getCombinedSelector() {
247
305
  const classSelector = this.getClassSelector()[0];
248
306
  return classSelector ? [`${this.getTagSelector()}${classSelector}`] : [];
@@ -1 +1 @@
1
- 1105
1
+ 1107
@@ -32,7 +32,7 @@
32
32
  return `'${value}'`;
33
33
  }
34
34
 
35
- // If the string has single quotes but no double quotes, wrap in double quotes
35
+ // If the string has no double quotes, wrap in double quotes
36
36
  if (!value.includes('"')) {
37
37
  return `"${value}"`;
38
38
  }
@@ -91,9 +91,24 @@
91
91
  selectors.add(selector),
92
92
  );
93
93
 
94
+ // Generate DOM position-based selectors
95
+ this.getDOMPositionSelectors().forEach((selector) =>
96
+ selectors.add(selector),
97
+ );
98
+
94
99
  // Combine selectors for robustness
95
100
  this.getCombinedSelector().forEach((selector) => selectors.add(selector));
96
101
 
102
+ function selectorTiebreakerPriority(sel) {
103
+ // highest-to-lowest: aria-label, placeholder, text-based XPath, DOM position, id, other
104
+ if (/\[aria-label\s*=/.test(sel) || /@aria-label/.test(sel)) return 0;
105
+ if (/\[placeholder\s*=/.test(sel) || /@placeholder/.test(sel)) return 1;
106
+ if (sel.startsWith('//')) return 2;
107
+ if (sel.includes(' > ')) return 3; // DOM position selector
108
+ if (/^#/.test(sel)) return 4;
109
+ return 5;
110
+ }
111
+
97
112
  const rankedSelectors = Array.from(selectors)
98
113
  .map((selector) => {
99
114
  try {
@@ -104,9 +119,18 @@
104
119
  }
105
120
  })
106
121
  .filter((a) => a !== null && a.count !== 0)
107
- .sort((a, b) => a.count - b.count);
122
+ .sort((a, b) => {
123
+ // 1. fewer matches -> better
124
+ if (a.count !== b.count) return a.count - b.count;
125
+ // 2. tie-break on priority class
126
+ return (
127
+ selectorTiebreakerPriority(a.selector) -
128
+ selectorTiebreakerPriority(b.selector)
129
+ );
130
+ })
131
+ .map((a) => a.selector);
108
132
 
109
- return rankedSelectors.map((a) => a.selector);
133
+ return rankedSelectors;
110
134
  }
111
135
 
112
136
  getIdSelector() {
@@ -243,6 +267,40 @@
243
267
  return [];
244
268
  }
245
269
 
270
+ getDOMPositionSelectors() {
271
+ const selectors = [];
272
+
273
+ // Generate full DOM position-based selector without depth limit
274
+ let currentElement = this.element;
275
+ let path = [];
276
+
277
+ // Build the complete path from the element up to html
278
+ while (currentElement && currentElement !== document) {
279
+ let tagName = currentElement.tagName.toLowerCase();
280
+ const parent = currentElement.parentElement;
281
+
282
+ if (parent) {
283
+ const siblings = Array.from(parent.children).filter(
284
+ (child) => child.tagName.toLowerCase() === tagName,
285
+ );
286
+ if (siblings.length > 1) {
287
+ const index = siblings.indexOf(currentElement) + 1;
288
+ tagName += `:nth-of-type(${index})`;
289
+ }
290
+ }
291
+
292
+ path.unshift(tagName);
293
+ currentElement = currentElement.parentElement;
294
+ }
295
+
296
+ // Create the full selector string with ">" separators
297
+ if (path.length > 1) {
298
+ selectors.push(path.join(' > '));
299
+ }
300
+
301
+ return selectors;
302
+ }
303
+
246
304
  getCombinedSelector() {
247
305
  const classSelector = this.getClassSelector()[0];
248
306
  return classSelector ? [`${this.getTagSelector()}${classSelector}`] : [];
@@ -19,6 +19,13 @@ export interface AnnotationBasedParameters extends BaseToolGptParameters, CorePa
19
19
  */
20
20
  annotation: string;
21
21
  }
22
+ /**
23
+ * Thin wrapper type that lets us easily map a selector query to a Locator object.
24
+ */
25
+ type SelectorLocator = {
26
+ selector: string;
27
+ locator: Locator;
28
+ };
22
29
  /**
23
30
  * Tools that specify a numbered Donobu annotation to indicate which element to
24
31
  * interact with and support deterministic reruns should extend this interface.
@@ -58,6 +65,8 @@ export declare abstract class ReplayableInteraction<CoreParameters, NonGptParame
58
65
  * @return A list of {@link Locator} objects that have been found, ordered by
59
66
  * their match count in ascending order.
60
67
  */
61
- static getLocatorsOrderedByMatchCount(page: Page, frameSelector: string | null, selectorCandidates: string[]): Promise<Locator[]>;
68
+ static getLocatorsOrderedByMatchCount(page: Page, frameSelector: string | null, selectorCandidates: string[]): Promise<SelectorLocator[]>;
69
+ private static selectorTiebreakerPriority;
62
70
  }
71
+ export {};
63
72
  //# sourceMappingURL=ReplayableInteraction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReplayableInteraction.d.ts","sourceRoot":"","sources":["../../../src/tools/ReplayableInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,cAAc;CAAG;AAElC,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC7D,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,WAAW,yBACf,SAAQ,qBAAqB,EAC3B,cAAc;IAChB;;OAEG;IACH,iBAA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,EAAE,MAAM,GAAG,IAAI,EAC5B,kBAAkB,EAAE,MAAM,EAAE,GAC3B,OAAO,CAAC,eAAe,EAAE,CAAC;IAmG7B,OAAO,CAAC,MAAM,CAAC,0BAA0B;CAS1C"}
@@ -46,6 +46,7 @@ class ReplayableInteraction extends Tool_1.Tool {
46
46
  frame: frameSelector,
47
47
  },
48
48
  };
49
+ break;
49
50
  }
50
51
  }
51
52
  if (!locatorData || !locatorData.locators.length) {
@@ -55,17 +56,22 @@ class ReplayableInteraction extends Tool_1.Tool {
55
56
  metadata: null,
56
57
  };
57
58
  }
58
- return this.callCore(context, parameters, locatorData.locators, locatorData.selectorForReplay);
59
+ return this.callCore(context, parameters, locatorData.locators.map((locator) => {
60
+ return {
61
+ selector: elementSelector,
62
+ locator: locator,
63
+ };
64
+ }), locatorData.selectorForReplay);
59
65
  }
60
- async callCore(context, parameters, locators, selectorForReplay) {
66
+ async callCore(context, parameters, selectorLocators, selectorForReplay) {
61
67
  const timeoutMilliseconds = 1000;
62
68
  const page = context.page;
63
- for (const locator of locators) {
69
+ for (const selectorLocator of selectorLocators) {
64
70
  try {
65
- const count = await locator.count();
71
+ const count = await selectorLocator.locator.count();
66
72
  for (let i = 0; i < count; ++i) {
67
73
  try {
68
- const originalLocator = locator.nth(i);
74
+ const originalLocator = selectorLocator.locator.nth(i);
69
75
  const element = (await PlaywrightUtils_1.PlaywrightUtils.getLocatorOrItsLabel(originalLocator)).first();
70
76
  await element.scrollIntoViewIfNeeded({
71
77
  timeout: timeoutMilliseconds,
@@ -74,7 +80,7 @@ class ReplayableInteraction extends Tool_1.Tool {
74
80
  timeout: timeoutMilliseconds,
75
81
  });
76
82
  if (!box) {
77
- throw new Error(`Failed to retrieve element bounding box for '${element}'; element may be offscreen or detached.`);
83
+ throw new Error(`Failed to retrieve element bounding box for element '${i}' for selector '${selectorLocator.selector}'; element may be offscreen or detached.`);
78
84
  }
79
85
  if (parameters.rationale) {
80
86
  // Show the rationale at the original locator because if the
@@ -85,9 +91,15 @@ class ReplayableInteraction extends Tool_1.Tool {
85
91
  // Hide the control panel so that it will not block an interaction if the
86
92
  // target element is underneath the panel.
87
93
  await PlaywrightUtils_1.PlaywrightUtils.hideControlPanel(context.page, context.metadata);
88
- const forLlm = await this.invoke(context, parameters, element);
94
+ let forLlm = await this.invoke(context, parameters, element);
89
95
  await PlaywrightUtils_1.PlaywrightUtils.showControlPanel(context.page, context.metadata);
90
96
  await PlaywrightUtils_1.PlaywrightUtils.waitForPageStability(page);
97
+ // If we did not use the Donobu attribute for resolving the element,
98
+ // add its selector to the result so we know which selector was
99
+ // ultimately used of the given 'selectorLocators'.
100
+ if (!selectorLocator.selector.includes(PlaywrightUtils_1.PlaywrightUtils.DONOBU_INTERACTABLE_ATTRIBUTE)) {
101
+ forLlm += ` (selector: '${selectorLocator.selector}')`;
102
+ }
91
103
  return {
92
104
  isSuccessful: true,
93
105
  forLlm: forLlm,
@@ -95,12 +107,12 @@ class ReplayableInteraction extends Tool_1.Tool {
95
107
  };
96
108
  }
97
109
  catch (elementError) {
98
- Logger_1.appLogger.error(`Failed to interact with element '${locator.nth(i)}' due to exception, will fail over to remaining elements (if any)`, elementError);
110
+ Logger_1.appLogger.error(`Failed to interact with element '${i}' for selector '${selectorLocator.selector}' due to exception, will fail over to remaining elements (if any)`, elementError);
99
111
  }
100
112
  }
101
113
  }
102
114
  catch (locatorError) {
103
- Logger_1.appLogger.error(`Failed to interact with locator '${locator.toString()}' due to exception, will fail over to remaining locators (if any)`, locatorError);
115
+ Logger_1.appLogger.error(`Failed to interact with selector '${selectorLocator.selector}' due to exception, will fail over to remaining selectors (if any)`, locatorError);
104
116
  }
105
117
  }
106
118
  return {
@@ -133,31 +145,68 @@ class ReplayableInteraction extends Tool_1.Tool {
133
145
  */
134
146
  static async getLocatorsOrderedByMatchCount(page, frameSelector, selectorCandidates) {
135
147
  try {
136
- const locators = [];
137
- for (const selectorCandidate of selectorCandidates) {
138
- try {
139
- const elementLocator = frameSelector
140
- ? page.frameLocator(frameSelector).locator(selectorCandidate)
141
- : page.locator(selectorCandidate);
142
- const count = await elementLocator.count();
143
- if (count > 0 &&
144
- ReplayableInteraction.MAX_LOCATOR_MATCH_COUNT >= count) {
145
- locators.push(elementLocator);
148
+ // Store the first selector promise separately
149
+ let firstSelectorResolver = null;
150
+ // Create a promise we can resolve early if the first selector is unique
151
+ const firstSelectorUniqueMatch = new Promise((resolve) => {
152
+ firstSelectorResolver = resolve;
153
+ });
154
+ // Process all selectors in parallel
155
+ const allSelectorsPromise = new Promise(async (resolve) => {
156
+ const locatorResults = [];
157
+ // Create and execute all promises in parallel
158
+ const promises = selectorCandidates.map(async (selectorCandidate, index) => {
159
+ try {
160
+ const elementLocator = frameSelector
161
+ ? page.frameLocator(frameSelector).locator(selectorCandidate)
162
+ : page.locator(selectorCandidate);
163
+ await elementLocator
164
+ .waitFor({
165
+ state: 'attached',
166
+ timeout: 2000,
167
+ })
168
+ .catch(() => {
169
+ // Continue if timeout
170
+ });
171
+ const count = await elementLocator.count();
172
+ // Special case: first selector with exactly one match
173
+ if (index === 0 && count === 1) {
174
+ firstSelectorResolver([
175
+ { selector: selectorCandidate, locator: elementLocator },
176
+ ]);
177
+ }
178
+ if (count > 0 &&
179
+ ReplayableInteraction.MAX_LOCATOR_MATCH_COUNT >= count) {
180
+ locatorResults.push({
181
+ selector: selectorCandidate,
182
+ locator: elementLocator,
183
+ count,
184
+ });
185
+ }
146
186
  }
147
- }
148
- catch (e) {
149
- Logger_1.appLogger.warn(`Invalid selector: ${selectorCandidate}`, e);
150
- }
151
- }
152
- // Create array of objects containing locator and its count
153
- const locatorsWithCounts = await Promise.all(locators.map(async (locator) => ({
154
- locator,
155
- count: await locator.count(),
156
- })));
157
- // Sort by count and return just the locators
158
- return locatorsWithCounts
159
- .sort((a, b) => a.count - b.count)
160
- .map((item) => item.locator);
187
+ catch (e) {
188
+ Logger_1.appLogger.warn(`Invalid selector: ${selectorCandidate}`, e);
189
+ }
190
+ });
191
+ // Wait for all selectors to be processed
192
+ await Promise.all(promises);
193
+ // Sort and return the results
194
+ resolve(locatorResults
195
+ .sort((a, b) => {
196
+ if (a.count !== b.count)
197
+ return a.count - b.count;
198
+ return (ReplayableInteraction.selectorTiebreakerPriority(a.selector) -
199
+ ReplayableInteraction.selectorTiebreakerPriority(b.selector));
200
+ })
201
+ .map((item) => {
202
+ return { selector: item.selector, locator: item.locator };
203
+ }));
204
+ });
205
+ // Race between the fast path and full processing
206
+ return await Promise.race([
207
+ firstSelectorUniqueMatch,
208
+ allSelectorsPromise,
209
+ ]);
161
210
  }
162
211
  catch (error) {
163
212
  if (PlaywrightUtils_1.PlaywrightUtils.isPageClosedError(error)) {
@@ -168,6 +217,20 @@ class ReplayableInteraction extends Tool_1.Tool {
168
217
  }
169
218
  }
170
219
  }
220
+ static selectorTiebreakerPriority(sel) {
221
+ // highest-to-lowest: aria-label, placeholder, text-based XPath, DOM position, id, other
222
+ if (/\[aria-label\s*=/.test(sel) || /@aria-label/.test(sel))
223
+ return 0;
224
+ if (/\[placeholder\s*=/.test(sel) || /@placeholder/.test(sel))
225
+ return 1;
226
+ if (sel.startsWith('//'))
227
+ return 2;
228
+ if (sel.includes(' > '))
229
+ return 3; // DOM position selector
230
+ if (/^#/.test(sel))
231
+ return 4;
232
+ return 5;
233
+ }
171
234
  }
172
235
  exports.ReplayableInteraction = ReplayableInteraction;
173
236
  ReplayableInteraction.MAX_LOCATOR_MATCH_COUNT = 5;
@@ -1 +1 @@
1
- {"version":3,"file":"ReplayableInteraction.js","sourceRoot":"","sources":["../../../src/tools/ReplayableInteraction.ts"],"names":[],"mappings":";;;AACA,8DAA2D;AAG3D,iCAA8B;AAE9B,4CAA4C;AAC5C,2EAAwE;AAuBxE;;;GAGG;AACH,MAAsB,qBAIpB,SAAQ,WAA4C;IAGpD,YACE,IAAY,EACZ,WAAmB,EACnB,kCAA0C,EAC1C,8BAAsC;QAEtC,KAAK,CACH,IAAI,EACJ,WAAW,EACX,kCAAkC,EACl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OAAO,KAAK,EAAE,CAAC;YACf,IAAI,iCAAe,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7C,MAAM,IAAI,yCAAmB,EAAE,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,0BAA0B,CAAC,GAAW;QACnD,wFAAwF;QACxF,IAAI,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC;QACtE,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC;QACxE,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,CAAC;QACnC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC,wBAAwB;QAC3D,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,CAAC,CAAC;IACX,CAAC;;AAnVH,sDAoVC;AA/UwB,6CAAuB,GAAG,CAAC,CAAC"}
@@ -19,6 +19,13 @@ export interface AnnotationBasedParameters extends BaseToolGptParameters, CorePa
19
19
  */
20
20
  annotation: string;
21
21
  }
22
+ /**
23
+ * Thin wrapper type that lets us easily map a selector query to a Locator object.
24
+ */
25
+ type SelectorLocator = {
26
+ selector: string;
27
+ locator: Locator;
28
+ };
22
29
  /**
23
30
  * Tools that specify a numbered Donobu annotation to indicate which element to
24
31
  * interact with and support deterministic reruns should extend this interface.
@@ -58,6 +65,8 @@ export declare abstract class ReplayableInteraction<CoreParameters, NonGptParame
58
65
  * @return A list of {@link Locator} objects that have been found, ordered by
59
66
  * their match count in ascending order.
60
67
  */
61
- static getLocatorsOrderedByMatchCount(page: Page, frameSelector: string | null, selectorCandidates: string[]): Promise<Locator[]>;
68
+ static getLocatorsOrderedByMatchCount(page: Page, frameSelector: string | null, selectorCandidates: string[]): Promise<SelectorLocator[]>;
69
+ private static selectorTiebreakerPriority;
62
70
  }
71
+ export {};
63
72
  //# sourceMappingURL=ReplayableInteraction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReplayableInteraction.d.ts","sourceRoot":"","sources":["../../src/tools/ReplayableInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,cAAc;CAAG;AAElC,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC7D,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,WAAW,yBACf,SAAQ,qBAAqB,EAC3B,cAAc;IAChB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,8BAAsB,qBAAqB,CACzC,cAAc,EACd,gBAAgB,SAAS,uBAAuB,GAAG,cAAc,EACjE,aAAa,SAAS,yBAAyB,GAAG,cAAc,CAChE,SAAQ,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC;IACpD,gBAAuB,uBAAuB,KAAK;gBAGjD,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,kCAAkC,EAAE,MAAM,EAC1C,8BAA8B,EAAE,MAAM;IAUlB,IAAI,CACxB,OAAO,EAAE,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,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,8BAAsB,qBAAqB,CACzC,cAAc,EACd,gBAAgB,SAAS,uBAAuB,GAAG,cAAc,EACjE,aAAa,SAAS,yBAAyB,GAAG,cAAc,CAChE,SAAQ,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC;IACpD,gBAAuB,uBAAuB,KAAK;gBAGjD,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,kCAAkC,EAAE,MAAM,EAC1C,8BAA8B,EAAE,MAAM;IAUlB,IAAI,CACxB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,gBAAgB,GAC3B,OAAO,CAAC,cAAc,CAAC;IAmBb,WAAW,CACtB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,aAAa,GACxB,OAAO,CAAC,cAAc,CAAC;IAwD1B;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,CACvB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,cAAc,EAC1B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC;YAEJ,QAAQ;IA4FtB;;;;;;;;;;;;;;;;;;;;;OAqBG;WACU,8BAA8B,CACzC,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,kBAAkB,EAAE,MAAM,EAAE,GAC3B,OAAO,CAAC,eAAe,EAAE,CAAC;IAmG7B,OAAO,CAAC,MAAM,CAAC,0BAA0B;CAS1C"}
@@ -46,6 +46,7 @@ class ReplayableInteraction extends Tool_1.Tool {
46
46
  frame: frameSelector,
47
47
  },
48
48
  };
49
+ break;
49
50
  }
50
51
  }
51
52
  if (!locatorData || !locatorData.locators.length) {
@@ -55,17 +56,22 @@ class ReplayableInteraction extends Tool_1.Tool {
55
56
  metadata: null,
56
57
  };
57
58
  }
58
- return this.callCore(context, parameters, locatorData.locators, locatorData.selectorForReplay);
59
+ return this.callCore(context, parameters, locatorData.locators.map((locator) => {
60
+ return {
61
+ selector: elementSelector,
62
+ locator: locator,
63
+ };
64
+ }), locatorData.selectorForReplay);
59
65
  }
60
- async callCore(context, parameters, locators, selectorForReplay) {
66
+ async callCore(context, parameters, selectorLocators, selectorForReplay) {
61
67
  const timeoutMilliseconds = 1000;
62
68
  const page = context.page;
63
- for (const locator of locators) {
69
+ for (const selectorLocator of selectorLocators) {
64
70
  try {
65
- const count = await locator.count();
71
+ const count = await selectorLocator.locator.count();
66
72
  for (let i = 0; i < count; ++i) {
67
73
  try {
68
- const originalLocator = locator.nth(i);
74
+ const originalLocator = selectorLocator.locator.nth(i);
69
75
  const element = (await PlaywrightUtils_1.PlaywrightUtils.getLocatorOrItsLabel(originalLocator)).first();
70
76
  await element.scrollIntoViewIfNeeded({
71
77
  timeout: timeoutMilliseconds,
@@ -74,7 +80,7 @@ class ReplayableInteraction extends Tool_1.Tool {
74
80
  timeout: timeoutMilliseconds,
75
81
  });
76
82
  if (!box) {
77
- throw new Error(`Failed to retrieve element bounding box for '${element}'; element may be offscreen or detached.`);
83
+ throw new Error(`Failed to retrieve element bounding box for element '${i}' for selector '${selectorLocator.selector}'; element may be offscreen or detached.`);
78
84
  }
79
85
  if (parameters.rationale) {
80
86
  // Show the rationale at the original locator because if the
@@ -85,9 +91,15 @@ class ReplayableInteraction extends Tool_1.Tool {
85
91
  // Hide the control panel so that it will not block an interaction if the
86
92
  // target element is underneath the panel.
87
93
  await PlaywrightUtils_1.PlaywrightUtils.hideControlPanel(context.page, context.metadata);
88
- const forLlm = await this.invoke(context, parameters, element);
94
+ let forLlm = await this.invoke(context, parameters, element);
89
95
  await PlaywrightUtils_1.PlaywrightUtils.showControlPanel(context.page, context.metadata);
90
96
  await PlaywrightUtils_1.PlaywrightUtils.waitForPageStability(page);
97
+ // If we did not use the Donobu attribute for resolving the element,
98
+ // add its selector to the result so we know which selector was
99
+ // ultimately used of the given 'selectorLocators'.
100
+ if (!selectorLocator.selector.includes(PlaywrightUtils_1.PlaywrightUtils.DONOBU_INTERACTABLE_ATTRIBUTE)) {
101
+ forLlm += ` (selector: '${selectorLocator.selector}')`;
102
+ }
91
103
  return {
92
104
  isSuccessful: true,
93
105
  forLlm: forLlm,
@@ -95,12 +107,12 @@ class ReplayableInteraction extends Tool_1.Tool {
95
107
  };
96
108
  }
97
109
  catch (elementError) {
98
- Logger_1.appLogger.error(`Failed to interact with element '${locator.nth(i)}' due to exception, will fail over to remaining elements (if any)`, elementError);
110
+ Logger_1.appLogger.error(`Failed to interact with element '${i}' for selector '${selectorLocator.selector}' due to exception, will fail over to remaining elements (if any)`, elementError);
99
111
  }
100
112
  }
101
113
  }
102
114
  catch (locatorError) {
103
- Logger_1.appLogger.error(`Failed to interact with locator '${locator.toString()}' due to exception, will fail over to remaining locators (if any)`, locatorError);
115
+ Logger_1.appLogger.error(`Failed to interact with selector '${selectorLocator.selector}' due to exception, will fail over to remaining selectors (if any)`, locatorError);
104
116
  }
105
117
  }
106
118
  return {
@@ -133,31 +145,68 @@ class ReplayableInteraction extends Tool_1.Tool {
133
145
  */
134
146
  static async getLocatorsOrderedByMatchCount(page, frameSelector, selectorCandidates) {
135
147
  try {
136
- const locators = [];
137
- for (const selectorCandidate of selectorCandidates) {
138
- try {
139
- const elementLocator = frameSelector
140
- ? page.frameLocator(frameSelector).locator(selectorCandidate)
141
- : page.locator(selectorCandidate);
142
- const count = await elementLocator.count();
143
- if (count > 0 &&
144
- ReplayableInteraction.MAX_LOCATOR_MATCH_COUNT >= count) {
145
- locators.push(elementLocator);
148
+ // Store the first selector promise separately
149
+ let firstSelectorResolver = null;
150
+ // Create a promise we can resolve early if the first selector is unique
151
+ const firstSelectorUniqueMatch = new Promise((resolve) => {
152
+ firstSelectorResolver = resolve;
153
+ });
154
+ // Process all selectors in parallel
155
+ const allSelectorsPromise = new Promise(async (resolve) => {
156
+ const locatorResults = [];
157
+ // Create and execute all promises in parallel
158
+ const promises = selectorCandidates.map(async (selectorCandidate, index) => {
159
+ try {
160
+ const elementLocator = frameSelector
161
+ ? page.frameLocator(frameSelector).locator(selectorCandidate)
162
+ : page.locator(selectorCandidate);
163
+ await elementLocator
164
+ .waitFor({
165
+ state: 'attached',
166
+ timeout: 2000,
167
+ })
168
+ .catch(() => {
169
+ // Continue if timeout
170
+ });
171
+ const count = await elementLocator.count();
172
+ // Special case: first selector with exactly one match
173
+ if (index === 0 && count === 1) {
174
+ firstSelectorResolver([
175
+ { selector: selectorCandidate, locator: elementLocator },
176
+ ]);
177
+ }
178
+ if (count > 0 &&
179
+ ReplayableInteraction.MAX_LOCATOR_MATCH_COUNT >= count) {
180
+ locatorResults.push({
181
+ selector: selectorCandidate,
182
+ locator: elementLocator,
183
+ count,
184
+ });
185
+ }
146
186
  }
147
- }
148
- catch (e) {
149
- Logger_1.appLogger.warn(`Invalid selector: ${selectorCandidate}`, e);
150
- }
151
- }
152
- // Create array of objects containing locator and its count
153
- const locatorsWithCounts = await Promise.all(locators.map(async (locator) => ({
154
- locator,
155
- count: await locator.count(),
156
- })));
157
- // Sort by count and return just the locators
158
- return locatorsWithCounts
159
- .sort((a, b) => a.count - b.count)
160
- .map((item) => item.locator);
187
+ catch (e) {
188
+ Logger_1.appLogger.warn(`Invalid selector: ${selectorCandidate}`, e);
189
+ }
190
+ });
191
+ // Wait for all selectors to be processed
192
+ await Promise.all(promises);
193
+ // Sort and return the results
194
+ resolve(locatorResults
195
+ .sort((a, b) => {
196
+ if (a.count !== b.count)
197
+ return a.count - b.count;
198
+ return (ReplayableInteraction.selectorTiebreakerPriority(a.selector) -
199
+ ReplayableInteraction.selectorTiebreakerPriority(b.selector));
200
+ })
201
+ .map((item) => {
202
+ return { selector: item.selector, locator: item.locator };
203
+ }));
204
+ });
205
+ // Race between the fast path and full processing
206
+ return await Promise.race([
207
+ firstSelectorUniqueMatch,
208
+ allSelectorsPromise,
209
+ ]);
161
210
  }
162
211
  catch (error) {
163
212
  if (PlaywrightUtils_1.PlaywrightUtils.isPageClosedError(error)) {
@@ -168,6 +217,20 @@ class ReplayableInteraction extends Tool_1.Tool {
168
217
  }
169
218
  }
170
219
  }
220
+ static selectorTiebreakerPriority(sel) {
221
+ // highest-to-lowest: aria-label, placeholder, text-based XPath, DOM position, id, other
222
+ if (/\[aria-label\s*=/.test(sel) || /@aria-label/.test(sel))
223
+ return 0;
224
+ if (/\[placeholder\s*=/.test(sel) || /@placeholder/.test(sel))
225
+ return 1;
226
+ if (sel.startsWith('//'))
227
+ return 2;
228
+ if (sel.includes(' > '))
229
+ return 3; // DOM position selector
230
+ if (/^#/.test(sel))
231
+ return 4;
232
+ return 5;
233
+ }
171
234
  }
172
235
  exports.ReplayableInteraction = ReplayableInteraction;
173
236
  ReplayableInteraction.MAX_LOCATOR_MATCH_COUNT = 5;
@@ -1 +1 @@
1
- {"version":3,"file":"ReplayableInteraction.js","sourceRoot":"","sources":["../../src/tools/ReplayableInteraction.ts"],"names":[],"mappings":";;;AACA,8DAA2D;AAG3D,iCAA8B;AAE9B,4CAA4C;AAC5C,2EAAwE;AAuBxE;;;GAGG;AACH,MAAsB,qBAIpB,SAAQ,WAA4C;IAGpD,YACE,IAAY,EACZ,WAAmB,EACnB,kCAA0C,EAC1C,8BAAsC;QAEtC,KAAK,CACH,IAAI,EACJ,WAAW,EACX,kCAAkC,EAClC,8BAA8B,CAC/B,CAAC;IACJ,CAAC;IAEe,KAAK,CAAC,IAAI,CACxB,OAAwB,EACxB,UAA4B;QAE5B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,8BAA8B,CACzE,IAAI,EACJ,UAAU,CAAC,QAAS,CAAC,KAAK,EAC1B,UAAU,CAAC,QAAS,CAAC,OAAO,CAC7B,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACrB,OAAO;gBACL,YAAY,EAAE,KAAK;gBACnB,MAAM,EAAE,yDAAyD;gBACjE,QAAQ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,GAAG,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC;QACxE,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,CAAC;QACnC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC,wBAAwB;QAC3D,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,CAAC,CAAC;IACX,CAAC;;AAnVH,sDAoVC;AA/UwB,6CAAuB,GAAG,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "donobu",
3
- "version": "2.14.1",
3
+ "version": "2.15.0",
4
4
  "description": "Create browser automations with an LLM agent and replay them as Playwright scripts.",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/esm/main.js",