fix: missing braces error
This commit is contained in:
@@ -483,31 +483,31 @@ export const BrowserWindow = () => {
|
||||
validatedChildSelectors.forEach((selector, index) => {
|
||||
try {
|
||||
const listElements = evaluateXPathAllWithShadowSupport(
|
||||
iframeElement.contentDocument!,
|
||||
listSelector,
|
||||
listSelector.includes(">>") || listSelector.startsWith("//")
|
||||
);
|
||||
|
||||
if (listElements.length === 0) return;
|
||||
|
||||
const hasNumericPredicate = /\[\d+\](?![^\[]*@)/.test(selector);
|
||||
|
||||
if (hasNumericPredicate && listElements.length >= 3) {
|
||||
const allMatches = evaluateXPathAllWithShadowSupport(
|
||||
iframeElement.contentDocument!,
|
||||
selector,
|
||||
selector.includes(">>") || selector.startsWith("//")
|
||||
listSelector,
|
||||
listSelector.includes(">>") || listSelector.startsWith("//")
|
||||
);
|
||||
|
||||
const matchRatio = allMatches.length / listElements.length;
|
||||
if (listElements.length === 0) return;
|
||||
|
||||
if (matchRatio < 0.6) {
|
||||
return;
|
||||
const hasNumericPredicate = /\[\d+\](?![^\[]*@)/.test(selector);
|
||||
|
||||
if (hasNumericPredicate && listElements.length >= 3) {
|
||||
const allMatches = evaluateXPathAllWithShadowSupport(
|
||||
iframeElement.contentDocument!,
|
||||
selector,
|
||||
selector.includes(">>") || selector.startsWith("//")
|
||||
);
|
||||
|
||||
const matchRatio = allMatches.length / listElements.length;
|
||||
|
||||
if (matchRatio < 0.6) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const firstListElement = listElements[0];
|
||||
|
||||
const firstListElement = listElements[0];
|
||||
|
||||
const elements = evaluateXPathAllWithShadowSupport(
|
||||
iframeElement.contentDocument!,
|
||||
selector,
|
||||
@@ -629,32 +629,32 @@ export const BrowserWindow = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const fieldId = Date.now() + index * 1000 + 500;
|
||||
candidateFields.push({
|
||||
id: fieldId,
|
||||
element: anchorParent as HTMLElement,
|
||||
isLeaf: true,
|
||||
depth: 0,
|
||||
position: position,
|
||||
field: {
|
||||
id: fieldId,
|
||||
type: "text",
|
||||
label: `Label ${index + 1} Link`,
|
||||
data: href,
|
||||
selectorObj: {
|
||||
selector: anchorSelector,
|
||||
attribute: 'href',
|
||||
tag: 'A',
|
||||
isShadow: anchorParent.getRootNode() instanceof ShadowRoot,
|
||||
fallbackSelector: generateFallbackSelector(anchorParent as HTMLElement)
|
||||
}
|
||||
const fieldId = Date.now() + index * 1000 + 500;
|
||||
candidateFields.push({
|
||||
id: fieldId,
|
||||
element: anchorParent as HTMLElement,
|
||||
isLeaf: true,
|
||||
depth: 0,
|
||||
position: position,
|
||||
field: {
|
||||
id: fieldId,
|
||||
type: "text",
|
||||
label: `Label ${index + 1} Link`,
|
||||
data: href,
|
||||
selectorObj: {
|
||||
selector: anchorSelector,
|
||||
attribute: 'href',
|
||||
tag: 'A',
|
||||
isShadow: anchorParent.getRootNode() instanceof ShadowRoot,
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error) {
|
||||
console.warn(`Failed to process child selector ${selector}:`, error);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user