How to set data in localStorage by Crawlee Puppeteer? In my case it return Access is denied

144 Views Asked by At

I'm using Crawlee with Puppeteer. I want set data in localStorage of related page. So I used the following code

preNavigationHooks: [
    async (crawlingContext,) => {

      const { page, request } = crawlingContext;

      const localStorage = await page.evaluate(() =>

        window.localStorage.setItem(
          'token',
          '8582ce8ff5ae52d5f93a64c08152c87858582ce85f93a640e0827d',
        ),
      );

But it return this error (Access is denied):

DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document

0

There are 0 best solutions below