@auto-wiz/playwright 1.1.0 → 1.1.1

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 (2) hide show
  1. package/dist/runner.js +29 -2
  2. package/package.json +2 -2
package/dist/runner.js CHANGED
@@ -99,8 +99,8 @@ class PlaywrightFlowRunner {
99
99
  else if (step.prop === "innerText") {
100
100
  text = await locator.innerText({ timeout });
101
101
  }
102
- else {
103
- // Default match 'outerHTML' if prop is not specified or explicit 'outerHTML'
102
+ else if (step.prop === "outerHTML") {
103
+ // Explicit 'outerHTML' requests full HTML (with SVGs stripped per existing logic)
104
104
  text = await locator.evaluate((el) => {
105
105
  const clone = el.cloneNode(true);
106
106
  const svgs = clone.querySelectorAll("svg");
@@ -108,6 +108,33 @@ class PlaywrightFlowRunner {
108
108
  return clone.outerHTML;
109
109
  });
110
110
  }
111
+ else {
112
+ // Default "structure": clean HTML, keep only id, name, text
113
+ text = await locator.evaluate((el) => {
114
+ const clone = el.cloneNode(true);
115
+ function cleanElement(element) {
116
+ // Remove all attributes except id and name
117
+ const attributes = Array.from(element.attributes);
118
+ for (const attr of attributes) {
119
+ if (!["id", "name"].includes(attr.name)) {
120
+ element.removeAttribute(attr.name);
121
+ }
122
+ }
123
+ // DFS for children
124
+ for (const child of Array.from(element.children)) {
125
+ // Remove SVGs entirely
126
+ if (child.tagName.toLowerCase() === "svg") {
127
+ child.remove();
128
+ }
129
+ else {
130
+ cleanElement(child);
131
+ }
132
+ }
133
+ }
134
+ cleanElement(clone);
135
+ return clone.outerHTML;
136
+ });
137
+ }
111
138
  return { success: true, extractedData: text?.trim() };
112
139
  }
113
140
  case "waitFor": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auto-wiz/playwright",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "license": "MIT",
5
5
  "author": "JaeSang",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "playwright": "^1.40.0",
27
- "@auto-wiz/core": "1.1.0"
27
+ "@auto-wiz/core": "1.1.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "typescript": "^5.0.0",