Skip to content

[FEATURE REQUEST] Window Data Inject #50

@ariel-frischer

Description

@ariel-frischer

Is your feature request related to a problem? Please describe.
I want to inject data into the window as described here: https://stackoverflow.com/a/56318041/1715153
I've tried this with the regular puppeteer package using page.evaluate() method and it works.
Example:

await page.evaluate(data => {
        window.renderData = {};
        window.renderData = data;
      }, renderData)

However, if I try to inject window data with timecut's preparePage or navigatePageToURL, neither seems to work. I need to pass this data object into the window so my frontend website can pick up the data. I tried to pass the data as an encoded url but that doesn't work because it gets too long and causes chromium 431 error.
Example of what I've tried with timecut:

preparePage: function (page) {
          return page.evaluate(function () {
              window.renderData = {};
              window.renderData = renderData;
            }
          );
        }

Describe the solution you'd like
Some way to inject data into the window before the page loads!

Describe alternatives you've considered
Using puppeteer instead which is not ideal.

P.S. I'm not sure if this is a bug or a feature request, I just need access to the puppeteer window during page.evaluate().

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions