@stablyai/internal-playwright-core 0.1.17 → 0.1.18

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.
@@ -1675,7 +1675,8 @@ import_validatorPrimitives.scheme.FrameFillResult = (0, import_validatorPrimitiv
1675
1675
  import_validatorPrimitives.scheme.FrameFocusParams = (0, import_validatorPrimitives.tObject)({
1676
1676
  selector: import_validatorPrimitives.tString,
1677
1677
  strict: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tBoolean),
1678
- timeout: import_validatorPrimitives.tFloat
1678
+ timeout: import_validatorPrimitives.tFloat,
1679
+ autoHeal: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tBoolean)
1679
1680
  });
1680
1681
  import_validatorPrimitives.scheme.FrameFocusResult = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
1681
1682
  import_validatorPrimitives.scheme.FrameFrameElementParams = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
@@ -1831,7 +1832,8 @@ import_validatorPrimitives.scheme.FrameSelectOptionParams = (0, import_validator
1831
1832
  index: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tInt)
1832
1833
  }))),
1833
1834
  force: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tBoolean),
1834
- timeout: import_validatorPrimitives.tFloat
1835
+ timeout: import_validatorPrimitives.tFloat,
1836
+ autoHeal: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tBoolean)
1835
1837
  });
1836
1838
  import_validatorPrimitives.scheme.FrameSelectOptionResult = (0, import_validatorPrimitives.tObject)({
1837
1839
  values: (0, import_validatorPrimitives.tArray)(import_validatorPrimitives.tString)
@@ -1854,7 +1856,8 @@ import_validatorPrimitives.scheme.FrameSetInputFilesParams = (0, import_validato
1854
1856
  directoryStream: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tChannel)(["WritableStream"])),
1855
1857
  localPaths: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tArray)(import_validatorPrimitives.tString)),
1856
1858
  streams: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tArray)((0, import_validatorPrimitives.tChannel)(["WritableStream"]))),
1857
- timeout: import_validatorPrimitives.tFloat
1859
+ timeout: import_validatorPrimitives.tFloat,
1860
+ autoHeal: (0, import_validatorPrimitives.tOptional)(import_validatorPrimitives.tBoolean)
1858
1861
  });
1859
1862
  import_validatorPrimitives.scheme.FrameSetInputFilesResult = (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tObject)({}));
1860
1863
  import_validatorPrimitives.scheme.FrameTapParams = (0, import_validatorPrimitives.tObject)({
@@ -168,7 +168,7 @@ async function attemptAutohealLocator({
168
168
  actionName,
169
169
  error
170
170
  }) {
171
- const description = (0, import_locatorGenerators.asLocatorDescription)("javascript", selector);
171
+ const description = (0, import_locatorGenerators.asUserDefinedLocatorDescription)(selector);
172
172
  if (!description) return void 0;
173
173
  const result = await healLocator({
174
174
  frame,
@@ -25,7 +25,8 @@ __export(locatorGenerators_exports, {
25
25
  PythonLocatorFactory: () => PythonLocatorFactory,
26
26
  asLocator: () => asLocator,
27
27
  asLocatorDescription: () => asLocatorDescription,
28
- asLocators: () => asLocators
28
+ asLocators: () => asLocators,
29
+ asUserDefinedLocatorDescription: () => asUserDefinedLocatorDescription
29
30
  });
30
31
  module.exports = __toCommonJS(locatorGenerators_exports);
31
32
  var import_selectorParser = require("./selectorParser");
@@ -44,6 +45,20 @@ function asLocatorDescription(lang, selector) {
44
45
  return selector;
45
46
  }
46
47
  }
48
+ function asUserDefinedLocatorDescription(selector) {
49
+ try {
50
+ const parsed = (0, import_selectorParser.parseSelector)(selector);
51
+ const lastPart = parsed.parts[parsed.parts.length - 1];
52
+ if (lastPart?.name === "internal:describe") {
53
+ const description = JSON.parse(lastPart.body);
54
+ if (typeof description === "string")
55
+ return description;
56
+ }
57
+ return void 0;
58
+ } catch (e) {
59
+ return selector;
60
+ }
61
+ }
47
62
  function asLocator(lang, selector, isFrameLocator = false) {
48
63
  return asLocators(lang, selector, isFrameLocator, 1)[0];
49
64
  }
@@ -669,5 +684,6 @@ function isRegExp(obj) {
669
684
  PythonLocatorFactory,
670
685
  asLocator,
671
686
  asLocatorDescription,
672
- asLocators
687
+ asLocators,
688
+ asUserDefinedLocatorDescription
673
689
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stablyai/internal-playwright-core",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",