Hello Everyone,
I’m creating a flow in Power Automate Desktop to test a webpage before deploying it to the production environment.
In this process, I need to fetch data from the Developer Tools (Console). Since I had trouble fetching the data directly from the Console, I created a popup box on the webpage through PAD. The flow captures all the data from the Console and places it into this popup box.
I was able to make this work for some of the buttons, but it isn’t working for a few others, as you can see in the screenshot. I’ve also attached the current flow in the screenshot for reference.
Please help me resolve this issue.
Below is the JavaScript code I used to create the popup box:
function () {
// install once
if (!window.__consoleTapInstalled) {
window.__consoleTapInstalled =
true;
const stamp = () =>
new Date().toISOString();
function ensurePanel() {
let d = document.getElementById(
'console-log-capture');
if (!d) {
d = document.createElement(
'div');
d.id =
'console-log-capture';
d.style.cssText = [
'position:fixed',
'bottom:10px',
'right:10px',
'width:560px',
'height:180px',
'overflow:auto',
'background:#fff',
'color:#000',
'border:1px solid #666',
'padding:6px',
'font:12px/1.3 monospace',
'z-index:2147483647'
].join(
';');
document.body.appendChild(d);
}
return d;
}
const push = (lvl, msg) => { ensurePanel().innerText += `[${stamp()}][${lvl}] ${msg}\n`; };
const e0 = console.error, w0 = console.warn, l0 = console.log;
console.error =
function (...a) { push(
'ERROR', a.join(
' ')); e0.apply(console, a); };
console.warn =
function (...a) { push(
'WARN', a.join(
' ')); w0.apply(console, a); };
console.log =
function (...a) { l0.apply(console, a); };
window.addEventListener(
'error', e =>
push(
'ERROR', (e.message||
'') + (e.filename ? ` @ ${e.filename}:${e.lineno||
''}` :
''))
);
window.addEventListener(
'unhandledrejection', e =>
push(
'ERROR', `UnhandledRejection ${e.reason||
''}`)
);
// self-heal if app re-renders
window.__consoleTapEnsure = ensurePanel;
setInterval(() => {
try {
if (!document.getElementById(
'console-log-capture')) ensurePanel(); }
catch (_) {}
},
800);
}
// show & clear for this check
const d = (window.__consoleTapEnsure && window.__consoleTapEnsure()) || document.getElementById(
'console-log-capture');
if (d) { d.style.display =
'block'; d.innerText =
''; }
return "ready";
}