async scrape(locator) {
console.log("Locator passed in is" + locator);
}
Why is the console log showing [object Object] as the output of the parameter? Shouldn't it return a value of whatever was passed in?
Here is the code calling the function:
Scenario('Scrape The Full Menu pricing and calorie data @scrapewebsite, {retries: 0}, async (I) => {
I.waitForElement({"xpath":".//select"});
rawMenuItems = await I.getElementsText({"xpath":".//*[contains(@data-ng-bind-html, 'item.title')]"});
uniqueMenuItems = [...new Set(rawMenuItems)];
for(let b = 0; b < uniqueMenuItems.length; b++ )
{
let locationVar = {"xpath":".//*[text()=\"" + uniqueMenuItems[b] + "\"]//following::*[@class=\"productControllers custom-product-ctrls\"][1]/div/div/select"};
uniqueMenuItems[b] = uniqueMenuItems[b].replace(/®.*/, "");
drinks[b] = await I.scrape(locationVar);
}
});