const {career, program, academicYear} = require("./vars"); async function handleDashboardForm(page) { try { const { career, program, academicYear } = require('./vars.js'); await page.waitForSelector('#QQ_RUNCNTL_OIS_ACAD_CAREER'); await new Promise((resolve) => setTimeout(resolve, 1000)); await page.evaluate((career) => { const inputField = document.querySelector('#QQ_RUNCNTL_OIS_ACAD_CAREER'); // Replace with your input field's ID if (inputField) { inputField.value = career; } }, career); await new Promise((resolve) => setTimeout(resolve, 1000)); await page.keyboard.press("Tab"); await page.evaluate((program) => { const inputField = document.querySelector('#QQ_RUNCNTL_OIS_ACAD_PROG'); // Replace with your input field's ID if (inputField) { inputField.value = program; } }, program); await new Promise((resolve) => setTimeout(resolve, 1000)); await page.keyboard.press("Tab"); await page.evaluate((academicYear) => { const inputField = document.querySelector('#QQ_RUNCNTL_OIS_STRM'); // Replace with your input field's ID if (inputField) { inputField.value = academicYear; } }, academicYear); await new Promise((resolve) => setTimeout(resolve, 1000)); await page.keyboard.press("Tab"); await page.select('#QQ_RUNCNTL_OIS_QQ_DP_TELLER', '01'); /* make sure the other fields are cleaned */ /* organisatie */ await page.evaluate(() => { const inputField = document.querySelector('#QQ_RUNCNTL_OIS_ACAD_ORG'); // Replace with your input field's ID if (inputField) { inputField.value = ''; } }); /* student ID */ await page.evaluate(() => { const inputField = document.querySelector('#QQ_RUNCNTL_OIS_EMPLID'); // Replace with your input field's ID if (inputField) { inputField.value = ''; } }); /* populatie = alle studenten */ await page.select('#QQ_RUNCNTL_OIS_QQ_STUD_SELECTOR', 'A'); /*selectie ophalen*/ await page.click("#QQ_RPT_OIS_WRK_QQ_KNOP_FILL_GRID"); return page; } catch (error) { console.error("An error occurred:", error); } } module.exports = handleDashboardForm;