I am writing a JavaScript code:
export const isURLImageAccessible = async (url) => {
// Some code
};
export const getImage = async (page, url) => {
const img = await page.evaluate(async () => {
const ogImgEl = document.querySelector("meta[property='og:image']");
const ogImg = ogImgEl?.getAttribute("content");
if (ogImg != null && (await isURLImageAccessible(ogImg))) {
return ogImg;
}
// Some more code
When I am calling the function it throws the following error:
Error: Evaluation failed: ReferenceError: isURLImageAccessible is not defined
Can anyone help?