sisa-crawl/gotodashboard.js
bdaneels 921cfa389c Refactor and document code; add new files
Refactored `script.py` by adding detailed docstrings and organizing functions. Created `.idea` configuration files and `gotodashboard.js` for `sisa_crawl` project. Added `readme.md` files with usage instructions and context for multiple scripts, and set up `package.json` for `sisa_crawl` dependencies.
2024-11-18 14:03:23 +01:00

31 lines
933 B
JavaScript

const {runId, dasbhoardInschrijvingenURL} = require('./vars.js');
async function runGoToDashboard(page) {
try {
await page.waitForSelector('#PS_SCP_REG_USER_F_S\\$19'); // Escape `$` in the ID
// Click the element
await page.click('#PS_SCP_REG_USER_F_S\\$19');
try {
await page.goto(dasbhoardInschrijvingenURL);
} catch (error) {
console.error("The page could not be reached.", error);
}
await page.waitForSelector('#PRCSRUNCNTL_RUN_CNTL_ID')
await page.type("#PRCSRUNCNTL_RUN_CNTL_ID[type='text']", runId)
await page.keyboard.press("Enter");
await page.waitForSelector('#PTS_CFG_CL_RSLT_NUI_SRCH1\\$12\\$\\$0')
await page.click('#PTS_CFG_CL_RSLT_NUI_SRCH1\\$12\\$\\$0')
return page;
} catch (error) {
console.error("An error occurred:", error);
}
}
module.exports = runGoToDashboard;