This is the analyzed page https://eservice.rclgroup.com/
I want to use Puppeteer to access the RATE INQUIRY tab but it seems to be rendered by a callGetrate() function;
I tried to use
await page.click(querySelectorAll('a[onclick^="callGetrate"]')) and try another way to access that callGetrate function by page.evalute(). Everything is not working. It just stops at the Booking Tab.
This is the function of the website
The callgetRate function of the RCLGROUP site
This is my code
try{
const browser = await puppeteer.launch({
headless: false,
args: [
"--disable-gpu",
"--disable-dev-shm-usage",
"--disable-setuid-sandbox",
"--no-sandbox",
],
defaultViewport: null,
});
const page = await browser.newPage();
await page.goto(`${constants.BASE_URL}e-commerce/`);
await page.waitForSelector('#userId');
await page.type('#userId', constants.userAccount.username , { delay: 100 });
await page.type('#password', constants.userAccount.password , { delay: 100 });
await page.click('input[type=submit]');
await page.evaluate(() => {
callGetrate();
})
const cookie = await page.cookies();
console.log(cookie);
return cookie.map((x) => `${x.name}=${x.value}`).join("; ");
}catch(error){
console.log("Failed to Login RCL ", error);
}
}
Please help me!