So this is the first time I've used puppeteer for testing purposes. But I've run into a strange error when running the
what I'm trying to do is run this function in the page, however
const puppeteer = require('puppeteer');
let browser, page,
//evaluates to file://C:/Users/chris/Google Drive/code projects/text translation sheet/test/src/index.html
htmlFilepath = "file://" + path.resolve(__dirname, "src/index.html");
browser = await puppeteer.launch();
page = await browser.newPage();
await page.goto(htmlFilepath);
page.exposeFunction(getMaxWordsInContentArea.name, getMaxWordsInContentArea)
const lastWordThatFit = await page.evaluate(function(){
const el = document.querySelector('.line__target-language-text')
const elContainer = el.parent;
const lastFitWordIndex = getMaxWordsInContentArea(el,elContainer,["Call", "me", "Ishmael.", "Some", "years", "ago—never", "mind", "how", "long", "precisely—having", "little", "or", "no", "money", "in", "my", "purse,", "and", "nothing", "particular", "to", "interest", "me", "on", "shore,", "I", "thought", "I", "would", "sail", "about", "a", "little", "and", "see", "the", "watery", "part", "of", "the", "world.", "It", "is", "a", "way", "I", "have", "of", "driving", "off", "the", "spleen", "and", "regulating", "the", "circulation."])
return lastFitWordIndex
});
Anybody see anything wrong with this or have familiarity with this error?