Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • H headless-chrome-crawler
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 29
    • Issues 29
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • yujiosaka
  • headless-chrome-crawler
  • Issues
  • #306
Closed
Open
Issue created Aug 10, 2018 by Administrator@rootContributor

Passing arguments to evaluatePage()

Created by: arthurakay

What is the current behavior?

  async _scrape() {
    if (!this._options.evaluatePage) return null;
    await this._addJQuery();
    return this._page.evaluate(this._options.evaluatePage);
  }

See the Puppeteer docs -- evaluatePage() can be passed arguments.

headless-chrome-crawler does not allow me to pass arguments to the function.

What is the motivation / use case for changing the behavior?

It would be nice to have access to variables from outside of the page context; e.g., if I needed code to eval in the page context.

Solution could be something like the following:

  async _scrape() {
    if (!this._options.evaluatePage) return null;
    await this._addJQuery();
    return this._page.evaluate(this._options.evaluatePage, this._options.evaluatePageArguments);
  }

I can issue a pull request for this (including some updates to the documentation), but I wanted to ask if this would even be considered/accepted first.

Assignee
Assign to
Time tracking