This topic was automatically generated from Slack. You can find the original thread here.
Hello! I’m using a simple script to take a screenshot using browserless, where it loads the page, selects an element on the page and takes the screenshot of just that element’s area.
Until then, it was working correctly, now I started getting the following error: Waiting for selector 'selector' failed: globalThis.btoa is not a function.
when i text the code in the browserless debbuger, the code works correctly
Does anyone have any idea what it could be?
Hello! I’m using a simple script to take a screenshot using browserless, where it loads the page, selects an element on the page and takes the screenshot of just that element’s area.
Until then, it was working correctly, now I started getting the following error: Waiting for selector 'selector' failed: globalThis.btoa is not a function.
when i text the code in the browserless debbuger, the code works correctly
Does anyone have any idea what it could be?
I understand that you’re encountering an issue with your script when using browserless to take a screenshot of a specific element. The error you’re experiencing is related to the globalThis.btoa function not being available. It’s possible that the environment in which your script is running might not have the btoa function available. To resolve this issue, you can try adding a polyfill for the btoa function in your script. Here’s an example of how you can define the btoa function if it’s not available: if (typeof globalThis.btoa === "undefined") { globalThis.btoa = function (str) { return Buffer.from(str, "binary").toString("base64"); }; } Add this code snippet at the beginning of your script, and it should define the btoa function if it’s not already available in the environment. If you still encounter issues, please provide more information about your script, such as the code you’re using, so I can better understand the problem and help you find a solution.