Skip to content

how to use in puppeteer script #478

@paragbaxi

Description

@paragbaxi

I want to continue the session that this creates to grab my privacy settings. How can I do that? I've tried the following:

const FacebookLogin = require('facebook-login-for-robots')

const facebookLogin = new FacebookLogin({
  facebook: {
    email: process.env.FACEBOOK_USER, 
    password: process.env.FACEBOOK_PWD
  },
  puppeteer: {
    headless: false // helpful for troubleshooting
  }
})
await facebookLogin.goto("https://www.facebook.com/settings?tab=privacy&view", {
    waitUntil: 'networkidle2'
});

I get the following error:

facebook.js:20
await facebookLogin.goto("https://www.facebook.com/settings?tab=privacy&view", {
^^^^^

SyntaxError: await is only valid in async function
    at Module._compile (internal/modules/cjs/loader.js:892:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
    at internal/main/run_main_module.js:17:11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions