Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] Puppeteer-extra launching #46

Closed
KorrGoFF opened this issue Jun 25, 2019 · 10 comments
Closed

[TypeScript] Puppeteer-extra launching #46

KorrGoFF opened this issue Jun 25, 2019 · 10 comments
Assignees
Labels
duplicate This issue or pull request already exists work-in-progress This is currently being worked on

Comments

@KorrGoFF
Copy link

import * as puppeteer from "puppeteer-extra";
// init method
puppeteer.launch({ headless: true }).then(async browser => {
      const page = await browser.newPage()
      await page.setViewport({ width: 800, height: 600 })
      await page.goto("https://bot.sannysoft.com")
      await page.waitFor(5000)
    });

returns
Uncaught (in promise) TypeError: merge is not a function
at PuppeteerExtra.launch (index.js:95)
at _callee2$ (Controller.js:42)
at tryCatch (runtime.js:45)
at Generator.invoke [as _invoke] (runtime.js:271)
at Generator.prototype. [as next] (runtime.js:97)
at asyncGeneratorStep (Controller.js:7)
at _next (Controller.js:9)
at eval (Controller.js:9)
at new Promise ()
at Controller.eval (Controller.js:9)

What could be the problem?

dep:
"@babel/polyfill": "^7.4.4",
"@types/jquery": "^3.3.29",
"@types/puppeteer": "^1.12.4",
"@types/sizzle": "^2.3.2",
"debug": "^4.1.1",
"deepmerge": "^3.3.0",
"kind-of": "^6.0.2",
"ms": "^2.1.2",
"puppeteer-cluster": "^0.16.0",
"puppeteer-extra-plugin": "^3.0.4",
"puppeteer-extra-plugin-anonymize-ua": "^2.1.4"

@leNicDev
Copy link

Same issue here.

@gabsoft
Copy link

gabsoft commented Oct 2, 2019

I'm having error with puppeter extra on require or import
Try npm install @types/puppeteer-extra if it exists or add a new declaration (.d.ts) file containing declare module 'puppeteer-extra';ts(7016)

And puppeteer-extra do not have @types

@ColeTownsend
Copy link

Ditto! Wondering if its ts-config related but no luck yet

@berstend berstend added the work-in-progress This is currently being worked on label Nov 24, 2019
@berstend
Copy link
Owner

berstend commented Nov 24, 2019

Hey there, I'm refactoring the core parts of puppeteer-extra in TS so these issues should be obsolete soon :)

@berstend berstend self-assigned this Nov 24, 2019
@berstend
Copy link
Owner

Closing as duplicate of #21

@berstend berstend added the duplicate This issue or pull request already exists label Nov 25, 2019
@lelinhtinh
Copy link

If you get this error when using Webpack, here's how to fix it: webpack/webpack#6584

const merge = require('deepmerge')

@berstend
Copy link
Owner

@KorrGoFF @leNicDev @ColeTownsend @gabsoft First class TypeScript support has just landed

import puppeteer from 'puppeteer-extra'

import RecaptchaPlugin from 'puppeteer-extra-plugin-recaptcha'
import StealthPlugin from 'puppeteer-extra-plugin-stealth'

puppeteer.use(RecaptchaPlugin()).use(StealthPlugin())

puppeteer.launch({ headless: false }).then(async browser => {
  const page = await browser.newPage()
  await page.setViewport({ width: 800, height: 600 })

  await page.goto('https://bot.sannysoft.com')
  await page.waitFor(5000)
  await page.screenshot({ path: 'stealth.png', fullPage: true })

  await browser.close()
})

image

@kamalkech
Copy link

this package not working on typescript apps, a lot of lot bugs

@nicubarbaros
Copy link

Screenshot 2024-01-16 at 17 03 12

I get this from inside puppeteer-extra :(

@PeterYang03110
Copy link

import puppeteer from 'puppeteer-extra';
import StealthPlugin from "puppeteer-extra-plugin-stealth";
import blockResourcesPlugin from "puppeteer-extra-plugin-block-resources";
import { delay } from './common/delay';

puppeteer.use(StealthPlugin()).use(blockResourcesPlugin({blockedTypes: new Set(["image", "media", "font"])}))

this code is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists work-in-progress This is currently being worked on
Projects
None yet
Development

No branches or pull requests

9 participants