diff --git a/server/src/workflow-management/selector.ts b/server/src/workflow-management/selector.ts index 0ef42c0c..90598563 100644 --- a/server/src/workflow-management/selector.ts +++ b/server/src/workflow-management/selector.ts @@ -81,10 +81,24 @@ export const getElementInformation = async ( innerText?: string; url?: string; imageUrl?: string; + attributes?: Record; + innerHTML?: string; + outerHTML?: string; } = { tagName: element?.tagName ?? '', }; + if (element) { + info.attributes = Array.from(element.attributes).reduce( + (acc, attr) => { + acc[attr.name] = attr.value; + return acc; + }, + {} as Record + ); + } + + // Gather specific information based on the tag if (element?.tagName === 'A') { info.url = (element as HTMLAnchorElement).href; info.innerText = element.innerText ?? ''; @@ -96,6 +110,9 @@ export const getElementInformation = async ( info.innerText = element?.innerText ?? ''; } + info.innerHTML = element.innerHTML; + info.outerHTML = element.outerHTML; + return info; } return null; diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index f848f28a..ddf4d0e1 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -14,6 +14,9 @@ interface ElementInfo { innerText?: string; url?: string; imageUrl?: string; + attributes?: Record; + innerHTML?: string; + outerHTML?: string; } interface AttributeOption {