Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const bundleJs = (
recordDom: boolean,
recordEvents: boolean,
pageIndex: number
) => {
const recordEventsJs = `window.qaw_recorder = window.qaw_recorder || new qawolf.Recorder("${CONFIG.dataAttribute}", ${pageIndex}, (event) => qaw_onEvent(event));`;
let bundle = qawolfJs;
if (recordDom) bundle += recordDomJs;
if (recordEvents) bundle += recordEventsJs;
return bundle;
};
`Browser: find element for ${JSON.stringify(step.target).substring(
0,
100
)}`
);
const page = await this.getPage(step.pageId, true);
const jsHandle = await page.evaluateHandle(
(locator: Locator) => {
const qawolf: QAWolfWeb = (window as any).qawolf;
return qawolf.locate.waitForElement(locator);
},
{
action: step.action,
dataAttribute: CONFIG.dataAttribute,
target: step.target,
timeoutMs: CONFIG.locatorTimeoutMs
} as Serializable
);
const handle = jsHandle.asElement();
if (!handle) {
throw new Error(`No element handle found for step ${step}`);
}
return handle;
}